Update specs for ansi quoting
This commit is contained in:
parent
608e4e8f43
commit
d68aa838e4
1 changed files with 11 additions and 11 deletions
|
@ -41,7 +41,7 @@ EOT
|
|||
end
|
||||
|
||||
it 'should query set priviliges' do
|
||||
provider_class.expects(:mysql).with(["--defaults-file=#{root_home}/.my.cnf", 'mysql', '-Be', 'select * from mysql.user where user="user" and host="host"']).returns <<-EOT
|
||||
provider_class.expects(:mysql).with(["--defaults-file=#{root_home}/.my.cnf", 'mysql', '-Be', "select * from mysql.user where user='user' and host='host'"]).returns <<-EOT
|
||||
Host User Password Select_priv Insert_priv Update_priv
|
||||
host user Y N Y
|
||||
EOT
|
||||
|
@ -49,7 +49,7 @@ EOT
|
|||
end
|
||||
|
||||
it 'should recognize when all priviliges are set' do
|
||||
provider_class.expects(:mysql).with(["--defaults-file=#{root_home}/.my.cnf", 'mysql', '-Be', 'select * from mysql.user where user="user" and host="host"']).returns <<-EOT
|
||||
provider_class.expects(:mysql).with(["--defaults-file=#{root_home}/.my.cnf", 'mysql', '-Be', "select * from mysql.user where user='user' and host='host'"]).returns <<-EOT
|
||||
Host User Password Select_priv Insert_priv Update_priv
|
||||
host user Y Y Y
|
||||
EOT
|
||||
|
@ -57,7 +57,7 @@ EOT
|
|||
end
|
||||
|
||||
it 'should recognize when all privileges are not set' do
|
||||
provider_class.expects(:mysql).with(["--defaults-file=#{root_home}/.my.cnf", 'mysql', '-Be', 'select * from mysql.user where user="user" and host="host"']).returns <<-EOT
|
||||
provider_class.expects(:mysql).with(["--defaults-file=#{root_home}/.my.cnf", 'mysql', '-Be', "select * from mysql.user where user='user' and host='host'"]).returns <<-EOT
|
||||
Host User Password Select_priv Insert_priv Update_priv
|
||||
host user Y N Y
|
||||
EOT
|
||||
|
@ -65,30 +65,30 @@ EOT
|
|||
end
|
||||
|
||||
it 'should be able to set all privileges' do
|
||||
provider_class.expects(:mysql).with(["--defaults-file=#{root_home}/.my.cnf", 'mysql', '-NBe', 'SELECT "1" FROM user WHERE user="user" AND host="host"']).returns "1\n"
|
||||
provider_class.expects(:mysql).with(["--defaults-file=#{root_home}/.my.cnf", 'mysql', '-Be', "update user set Select_priv = 'Y', Insert_priv = 'Y', Update_priv = 'Y' where user=\"user\" and host=\"host\""])
|
||||
provider_class.expects(:mysql).with(["--defaults-file=#{root_home}/.my.cnf", 'mysql', '-NBe', "SELECT '1' FROM user WHERE user='user' AND host='host'"]).returns "1\n"
|
||||
provider_class.expects(:mysql).with(["--defaults-file=#{root_home}/.my.cnf", 'mysql', '-Be', "update user set Select_priv = 'Y', Insert_priv = 'Y', Update_priv = 'Y' where user='user' and host='host'"])
|
||||
provider_class.expects(:mysqladmin).with(["--defaults-file=#{root_home}/.my.cnf", "flush-privileges"])
|
||||
@provider.privileges=(['all'])
|
||||
end
|
||||
|
||||
it 'should be able to set partial privileges' do
|
||||
provider_class.expects(:mysql).with(["--defaults-file=#{root_home}/.my.cnf", 'mysql', '-NBe', 'SELECT "1" FROM user WHERE user="user" AND host="host"']).returns "1\n"
|
||||
provider_class.expects(:mysql).with(["--defaults-file=#{root_home}/.my.cnf", 'mysql', '-Be', "update user set Select_priv = 'Y', Insert_priv = 'N', Update_priv = 'Y' where user=\"user\" and host=\"host\""])
|
||||
provider_class.expects(:mysql).with(["--defaults-file=#{root_home}/.my.cnf", 'mysql', '-NBe', "SELECT '1' FROM user WHERE user='user' AND host='host'"]).returns "1\n"
|
||||
provider_class.expects(:mysql).with(["--defaults-file=#{root_home}/.my.cnf", 'mysql', '-Be', "update user set Select_priv = 'Y', Insert_priv = 'N', Update_priv = 'Y' where user='user' and host='host'"])
|
||||
provider_class.expects(:mysqladmin).with(["--defaults-file=#{root_home}/.my.cnf", "flush-privileges"])
|
||||
@provider.privileges=(['Select_priv', 'Update_priv'])
|
||||
end
|
||||
|
||||
it 'should be case insensitive' do
|
||||
provider_class.expects(:mysql).with(["--defaults-file=#{root_home}/.my.cnf", 'mysql', '-NBe', 'SELECT "1" FROM user WHERE user="user" AND host="host"']).returns "1\n"
|
||||
provider_class.expects(:mysql).with(["--defaults-file=#{root_home}/.my.cnf", 'mysql', '-Be', "update user set Select_priv = 'Y', Insert_priv = 'Y', Update_priv = 'Y' where user=\"user\" and host=\"host\""])
|
||||
provider_class.expects(:mysql).with(["--defaults-file=#{root_home}/.my.cnf", 'mysql', '-NBe', "SELECT '1' FROM user WHERE user='user' AND host='host'"]).returns "1\n"
|
||||
provider_class.expects(:mysql).with(["--defaults-file=#{root_home}/.my.cnf", 'mysql', '-Be', "update user set Select_priv = 'Y', Insert_priv = 'Y', Update_priv = 'Y' where user='user' and host='host'"])
|
||||
provider_class.expects(:mysqladmin).with(["--defaults-file=#{root_home}/.my.cnf", 'flush-privileges'])
|
||||
@provider.privileges=(['SELECT_PRIV', 'insert_priv', 'UpDaTe_pRiV'])
|
||||
end
|
||||
|
||||
it 'should not pass --defaults-file if $root_home/.my.cnf is absent' do
|
||||
File.stubs(:file?).with("#{root_home}/.my.cnf").returns(false)
|
||||
provider_class.expects(:mysql).with(['mysql', '-NBe', 'SELECT "1" FROM user WHERE user="user" AND host="host"']).returns "1\n"
|
||||
provider_class.expects(:mysql).with(['mysql', '-Be', "update user set Select_priv = 'Y', Insert_priv = 'N', Update_priv = 'Y' where user=\"user\" and host=\"host\""])
|
||||
provider_class.expects(:mysql).with(['mysql', '-NBe', "SELECT '1' FROM user WHERE user='user' AND host='host'"]).returns "1\n"
|
||||
provider_class.expects(:mysql).with(['mysql', '-Be', "update user set Select_priv = 'Y', Insert_priv = 'N', Update_priv = 'Y' where user='user' and host='host'"])
|
||||
provider_class.expects(:mysqladmin).with(["flush-privileges"])
|
||||
@provider.privileges=(['Select_priv', 'Update_priv'])
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue