diff options
Diffstat (limited to 'activerecord/test')
-rwxr-xr-x | activerecord/test/fixtures_test.rb | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/activerecord/test/fixtures_test.rb b/activerecord/test/fixtures_test.rb index 2f88feda3f..96788a09bd 100755 --- a/activerecord/test/fixtures_test.rb +++ b/activerecord/test/fixtures_test.rb @@ -361,4 +361,30 @@ class ManyToManyFixturesWithClassDefined < Test::Unit::TestCase def test_this_should_run_cleanly assert true end -end
\ No newline at end of file +end + + +class FixturesBrokenRollbackTest < Test::Unit::TestCase + def blank_setup; end + alias_method :ar_setup_with_fixtures, :setup_with_fixtures + alias_method :setup_with_fixtures, :blank_setup + alias_method :setup, :blank_setup + + def blank_teardown; end + alias_method :ar_teardown_with_fixtures, :teardown_with_fixtures + alias_method :teardown_with_fixtures, :blank_teardown + alias_method :teardown, :blank_teardown + + def test_no_rollback_in_teardown_unless_transaction_active + assert_equal 0, Thread.current['open_transactions'] + assert_raise(RuntimeError) { ar_setup_with_fixtures } + assert_equal 0, Thread.current['open_transactions'] + assert_nothing_raised { ar_teardown_with_fixtures } + assert_equal 0, Thread.current['open_transactions'] + end + + private + def load_fixtures + raise 'argh' + end +end |