Permalink
Browse files

test that the transaction block is yielded with master

  • Loading branch information...
1 parent db3d304 commit 7fb1261956c47f741abcfda890490ccceccc06bd @mislav committed Apr 13, 2009
Showing with 5 additions and 1 deletion.
  1. +5 −1 test/connection_proxy_test.rb
View
6 test/connection_proxy_test.rb
@@ -140,10 +140,14 @@ def test_with_master
end
def test_transactions_run_on_master
- @master.expects(:transaction).with({:foo => 'bar'})
+ @master.expects(:transaction).with(:foo => 'bar').yields
+
+ assert_equal :slave, connection.current_type
ActiveRecord::Base.transaction(:foo => 'bar') do
# hardcore transaction stuff
+ assert_equal :master, connection.current_type
end
+ assert_equal :slave, connection.current_type
end
end

0 comments on commit 7fb1261

Please sign in to comment.