Skip to content
This repository has been archived by the owner on May 31, 2024. It is now read-only.

Commit

Permalink
Fix spec
Browse files Browse the repository at this point in the history
  • Loading branch information
Genki Sugawara committed Oct 8, 2014
1 parent 371df20 commit b211648
Showing 1 changed file with 50 additions and 2 deletions.
52 changes: 50 additions & 2 deletions spec/change/change_grants_target_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,61 @@
}

expect(show_grants).to match_array [
"GRANT SELECT (user) ON `mysql`.`user` TO 'scott'@'localhost'",
"GRANT SELECT ON `test`.* TO 'bob'@'localhost'",
"GRANT SELECT, INSERT ON *.* TO 'scott'@'localhost' IDENTIFIED BY PASSWORD '*F2F68D0BB27A773C1D944270E5FAFED515A3FA40' REQUIRE SSL",
"GRANT UPDATE, DELETE ON `test`.* TO 'scott'@'localhost'",
"GRANT USAGE ON *.* TO 'bob'@'localhost'",
]
end
end

context 'when grant privs with target (no change)' do
subject { client(target_user: /mary/) }

it do
apply(subject) {
<<-RUBY
user 'scott', 'localhost', required: 'SSL' do
on '*.*' do
grant 'SELECT'
grant 'INSERT'
grant 'UPDATE'
grant 'DELETE'
end
on 'test.*' do
grant 'SELECT'
grant 'INSERT'
grant 'UPDATE'
grant 'DELETE'
end
on 'mysql.user' do
grant 'SELECT (user)'
grant 'UPDATE (host)'
end
end
user 'bob', 'localhost' do
on '*.*' do
grant 'USAGE'
end
on 'test.*' do
grant 'SELECT'
end
end
RUBY
}

expect(show_grants).to match_array [
"GRANT SELECT (user) ON `mysql`.`user` TO 'scott'@'localhost'",
"GRANT SELECT, INSERT, ON *.* TO 'scott'@'localhost' IDENTIFIED BY PASSWORD '*F2F68D0BB27A773C1D944270E5FAFED515A3FA40' REQUIRE SSL",
"GRANT ALL PRIVILEGES ON `test`.* TO 'bob'@'localhost'",
"GRANT SELECT, INSERT ON *.* TO 'scott'@'localhost' IDENTIFIED BY PASSWORD '*F2F68D0BB27A773C1D944270E5FAFED515A3FA40' REQUIRE SSL",
"GRANT UPDATE, DELETE ON `test`.* TO 'scott'@'localhost'",
"GRANT USAGE ON *.* TO 'bob'@'localhost'",
]
end
end

end

0 comments on commit b211648

Please sign in to comment.