mirror of
https://github.com/DatabaseCleaner/database_cleaner
synced 2023-03-27 23:22:03 -04:00
adds simple spec about being able to pass in a AR model as :db
This commit is contained in:
parent
de69f81241
commit
4a5399ee1e
1 changed files with 11 additions and 0 deletions
|
@ -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)}
|
||||
|
|
Loading…
Reference in a new issue