adds simple spec about being able to pass in a AR model as :db

This commit is contained in:
Ben Mabey 2012-08-25 12:08:12 -06:00
parent de69f81241
commit 4a5399ee1e

View file

@ -3,6 +3,12 @@ require 'active_record'
require 'database_cleaner/active_record/base'
require 'database_cleaner/shared_strategy'
class FakeModel
def self.connection
:fake_connection
end
end
module DatabaseCleaner
describe ActiveRecord do
it { should respond_to(:available_strategies) }
@ -121,6 +127,11 @@ my_db:
subject.connection_class.should == ::ActiveRecord::Base
end
it "allows for database models to be passed in" do
subject.db = FakeModel
subject.connection_class.should == FakeModel
end
context "when connection_hash is set" do
let(:hash) { mock("hash") }
before { ::ActiveRecord::Base.stub!(:respond_to?).and_return(false)}