diff --git a/lib/database_cleaner/active_record/base.rb b/lib/database_cleaner/active_record/base.rb index 1540483..dcf1e93 100644 --- a/lib/database_cleaner/active_record/base.rb +++ b/lib/database_cleaner/active_record/base.rb @@ -77,6 +77,7 @@ module DatabaseCleaner def establish_connection ::ActiveRecord::Base.establish_connection(connection_hash) + ::ActiveRecord::Base end end diff --git a/spec/database_cleaner/active_record/base_spec.rb b/spec/database_cleaner/active_record/base_spec.rb index ff5be7f..370356f 100644 --- a/spec/database_cleaner/active_record/base_spec.rb +++ b/spec/database_cleaner/active_record/base_spec.rb @@ -181,6 +181,12 @@ my_db: subject.connection_class end + + it "returns the connection class" do + ::ActiveRecord::Base.stub(:establish_connection) + + subject.connection_class.should eq ::ActiveRecord::Base + end end end end