examples/unit/mysqldump_example.rb in astrails-safe-0.2.6 vs examples/unit/mysqldump_example.rb in astrails-safe-0.2.7
- old
+ new
@@ -1,19 +1,19 @@
require File.expand_path(File.dirname(__FILE__) + '/../example_helper')
describe Astrails::Safe::Mysqldump do
- def def_config
+ def def_config(extra = {})
{
:options => "OPTS",
:user => "User",
:password => "pwd",
:host => "localhost",
:port => 7777,
:socket => "socket",
:skip_tables => [:bar, :baz]
- }
+ }.merge(extra)
end
def mysqldump(id = :foo, config = def_config)
Astrails::Safe::Mysqldump.new(id, Astrails::Safe::Config::Node.new(nil, config))
end
@@ -64,19 +64,19 @@
end
end
describe :mysql_password_file do
- it "should create passwords file" do
- m = mysqldump
+ it "should create passwords file with quoted values" do
+ m = mysqldump(:foo, def_config(:password => '#qwe"asd\'zxc'))
file = m.send(:mysql_password_file)
File.exists?(file).should == true
File.read(file).should == <<-PWD
[mysqldump]
-user = User
-password = pwd
-socket = socket
-host = localhost
+user = "User"
+password = "#qwe\\"asd'zxc"
+socket = "socket"
+host = "localhost"
port = 7777
PWD
end
end
end
\ No newline at end of file