diff options
Diffstat (limited to 'spec/unit/rails.rb')
-rwxr-xr-x | spec/unit/rails.rb | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/spec/unit/rails.rb b/spec/unit/rails.rb index da6db1548..089f48d27 100755 --- a/spec/unit/rails.rb +++ b/spec/unit/rails.rb @@ -42,7 +42,7 @@ describe Puppet::Rails, "when initializing any connection" do ActiveRecord::Base.stubs(:allow_concurrency=) ActiveRecord::Base.stubs(:verify_active_connections!) ActiveRecord::Base.stubs(:establish_connection) - Puppet::Rails.stubs(:database_arguments) + Puppet::Rails.stubs(:database_arguments).returns({}) Puppet::Rails.connect end @@ -64,7 +64,7 @@ describe Puppet::Rails, "when initializing any connection" do end it "should call ActiveRecord::Base.establish_connection with database_arguments" do - Puppet::Rails.expects(:database_arguments) + Puppet::Rails.expects(:database_arguments).returns({}) ActiveRecord::Base.expects(:establish_connection) Puppet::Rails.connect @@ -74,15 +74,15 @@ end describe Puppet::Rails, "when initializing a sqlite3 connection" do confine "Cannot test without ActiveRecord" => Puppet.features.rails? - it "should provide the adapter, log_level, and dbfile arguments" do + it "should provide the adapter, log_level, and database arguments" do Puppet.settings.expects(:value).with(:dbadapter).returns("sqlite3") Puppet.settings.expects(:value).with(:rails_loglevel).returns("testlevel") Puppet.settings.expects(:value).with(:dblocation).returns("testlocation") Puppet::Rails.database_arguments.should == { - :adapter => "sqlite3", + :adapter => "sqlite3", :log_level => "testlevel", - :dbfile => "testlocation" + :database => "testlocation" } end end @@ -90,7 +90,7 @@ end describe Puppet::Rails, "when initializing a mysql connection" do confine "Cannot test without ActiveRecord" => Puppet.features.rails? - it "should provide the adapter, log_level, and host, username, password, and database arguments" do + it "should provide the adapter, log_level, and host, username, password, database, and reconnect arguments" do Puppet.settings.stubs(:value).with(:dbadapter).returns("mysql") Puppet.settings.stubs(:value).with(:rails_loglevel).returns("testlevel") Puppet.settings.stubs(:value).with(:dbserver).returns("testserver") @@ -105,11 +105,12 @@ describe Puppet::Rails, "when initializing a mysql connection" do :host => "testserver", :username => "testuser", :password => "testpassword", - :database => "testname" + :database => "testname", + :reconnect => true } end - it "should provide the adapter, log_level, and host, username, password, database, and socket arguments" do + it "should provide the adapter, log_level, and host, username, password, database, socket, and reconnect arguments" do Puppet.settings.stubs(:value).with(:dbadapter).returns("mysql") Puppet.settings.stubs(:value).with(:rails_loglevel).returns("testlevel") Puppet.settings.stubs(:value).with(:dbserver).returns("testserver") @@ -125,7 +126,8 @@ describe Puppet::Rails, "when initializing a mysql connection" do :username => "testuser", :password => "testpassword", :database => "testname", - :socket => "testsocket" + :socket => "testsocket", + :reconnect => true } end |