Skip to content

Commit

Permalink
Merge pull request #6451 from chancancode/3-2-stable_restore_frozen_s…
Browse files Browse the repository at this point in the history
…tate_on_rollback

Fixes the build break caused by 9ee8528 in #6445.
  • Loading branch information
rafaelfranca committed May 22, 2012
2 parents 9ee8528 + d3715f6 commit ff3cddf
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions activerecord/test/cases/transactions_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -363,10 +363,12 @@ def test_rollback_when_commit_raises
end

def test_rollback_when_saving_a_frozen_record
expected_raise = (RUBY_VERSION < '1.9') ? TypeError : RuntimeError

topic = Topic.new(:title => 'test')
topic.freeze
e = assert_raise(RuntimeError) { topic.save }
assert_equal "can't modify frozen Hash", e.message
e = assert_raise(expected_raise) { topic.save }
assert_equal "can't modify frozen hash", e.message.downcase
assert !topic.persisted?, 'not persisted'
assert_nil topic.id
assert topic.frozen?, 'not frozen'
Expand Down

0 comments on commit ff3cddf

Please sign in to comment.