Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #181 from smasry/master

Fixing tests for ar transaction class
  • Loading branch information...
commit 43c382ffcd97754658b90eb9f8f5359e2af80957 2 parents 1ddad99 + 5ff942b
@bmabey bmabey authored
Showing with 6 additions and 4 deletions.
  1. +6 −4 spec/database_cleaner/active_record/transaction_spec.rb
View
10 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)
Please sign in to comment.
Something went wrong with that request. Please try again.