Permalink
Browse files

Merge pull request #181 from smasry/master

Fixing tests for ar transaction class
  • Loading branch information...
2 parents 1ddad99 + 5ff942b commit 43c382ffcd97754658b90eb9f8f5359e2af80957 @bmabey bmabey committed Feb 8, 2013
Showing with 6 additions and 4 deletions.
  1. +6 −4 spec/database_cleaner/active_record/transaction_spec.rb
@@ -38,18 +38,19 @@ module ActiveRecord
describe "#clean" do
it "should start a transaction" do
- connection.should_receive(:open_transactions).and_return(1)
+ connection.should_receive(:open_transactions).and_return(1)
- connection.stub!(:decrement_open_transactions)
+ connection.stub!(:decrement_open_transactions)
- connection.should_receive(:rollback_db_transaction)
- Transaction.new.clean
+ connection.should_receive(:rollback_db_transaction)
+ Transaction.new.clean
end
it "should decrement open transactions if possible" do
connection.should_receive(:open_transactions).and_return(1)
connection.stub!(:respond_to?).with(:decrement_open_transactions).and_return(true)
+ connection.stub!(:respond_to?).with(:rollback_transaction_records).and_return(false)
connection.stub!(:rollback_db_transaction)
connection.should_receive(:decrement_open_transactions)
@@ -65,6 +66,7 @@ module ActiveRecord
it "should decrement connection via ActiveRecord::Base if connection won't" do
connection.should_receive(:open_transactions).and_return(1)
connection.stub!(:respond_to?).with(:decrement_open_transactions).and_return(false)
+ connection.stub!(:respond_to?).with(:rollback_transaction_records).and_return(false)
connection.stub!(:rollback_db_transaction)
::ActiveRecord::Base.should_receive(:decrement_open_transactions)

0 comments on commit 43c382f

Please sign in to comment.