can't seem to get a multiple db setup to work and I can't find any examples of doing this...
here is what I've got so far,
database.yml
test_security:
adapter: postgresql
username: psg_user_1
password:
database: db_1
pool: 5
timeout: 5000
test:
encoding: unicode
adapter: postgresql
username: psg_user_2
database: db_2
password:
branch_test:
encoding: unicode
adapter: postgresql
username: psg_user_1=2
database: db_3
password:
and in spec_helper:
config.before(:suite) do
DatabaseCleaner.strategy = :transaction
DatabaseCleaner.clean_with :truncation
DatabaseCleaner[:active_record,{:connection => :branch_test}].strategy = :transaction
DatabaseCleaner[:active_record,{:connection => :branch_test}].clean_with :truncation
DatabaseCleaner[:active_record, {:connection => :test_security}].strategy = :transaction
DatabaseCleaner[:active_record, {:connection => :test_security}].clean_with :truncation
end
config.before(:each) do
DatabaseCleaner.start
end
config.after(:each) do
DatabaseCleaner.clean
end
however, when I run specs I keep getting...
You have a nil object when you didn't expect it!
You might have expected an instance of Array.
The error occurred while evaluating nil.-
/Users/andy/.rvm/gems/ree-1.8.7-2011.03@sdbpg/gems/activerecord-2.3.11/lib/active_record/connection_adapters/abstract_adapter.rb:175:in decrement_open_transactions' /Users/andy/.rvm/gems/ree-1.8.7-2011.03@sdbpg/gems/database_cleaner-0.6.6/lib/database_cleaner/active_record/transaction.rb:20:in
clean'
/Users/andy/.rvm/gems/ree-1.8.7-2011.03@sdbpg/gems/database_cleaner-0.6.6/lib/database_cleaner/base.rb:77:in clean' /Users/andy/.rvm/gems/ree-1.8.7-2011.03@sdbpg/gems/database_cleaner-0.6.6/lib/database_cleaner/configuration.rb:56:in
clean'
/Users/andy/.rvm/gems/ree-1.8.7-2011.03@sdbpg/gems/database_cleaner-0.6.6/lib/database_cleaner/configuration.rb:56:in each' /Users/andy/.rvm/gems/ree-1.8.7-2011.03@sdbpg/gems/database_cleaner-0.6.6/lib/database_cleaner/configuration.rb:56:in
clean'
/Users/andy/gits/sdbpg/spec/spec_helper.rb:42:
where line 42 corresponds to the "DatabaseCleaner.clean" line
when I comment out the other connection then it appears to not clear data
any help is much appreciated