From 23eb81a3d1eb154a3aefe569408d1bb2ed63c554 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Sun, 1 May 2011 11:55:13 -0700 Subject: assert_difference can take a callable piece of code rather than just evaling a string --- .../test/cases/associations/belongs_to_associations_test.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'activerecord/test') diff --git a/activerecord/test/cases/associations/belongs_to_associations_test.rb b/activerecord/test/cases/associations/belongs_to_associations_test.rb index 7518bc19f9..ddcc36c841 100644 --- a/activerecord/test/cases/associations/belongs_to_associations_test.rb +++ b/activerecord/test/cases/associations/belongs_to_associations_test.rb @@ -576,11 +576,11 @@ class BelongsToAssociationsTest < ActiveRecord::TestCase end def test_polymorphic_counter_cache - tagging = taggings(:welcome_general) - post = post = posts(:welcome) - comment = comments(:greetings) + tagging = taggings(:welcome_general) + post = posts(:welcome) + comment = comments(:greetings) - assert_difference 'post.reload.taggings_count', -1 do + assert_difference lambda { post.reload.taggings_count }, -1 do assert_difference 'comment.reload.taggings_count', +1 do tagging.taggable = comment end -- cgit v1.2.3