From c5888508685c3a19413bb3158ff1c53649f5957c Mon Sep 17 00:00:00 2001 From: Carlos Antonio da Silva Date: Sat, 3 May 2014 14:31:00 -0300 Subject: Refactor test to not care about the specific result of valid? Only care about its truthiness rather than asserting specific true/false values. If we need to check for the return value in particular, there will be a test for that. --- activerecord/test/cases/associations/has_many_associations_test.rb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'activerecord/test') diff --git a/activerecord/test/cases/associations/has_many_associations_test.rb b/activerecord/test/cases/associations/has_many_associations_test.rb index d748e80695..70afbe1332 100644 --- a/activerecord/test/cases/associations/has_many_associations_test.rb +++ b/activerecord/test/cases/associations/has_many_associations_test.rb @@ -1886,11 +1886,12 @@ class HasManyAssociationsTest < ActiveRecord::TestCase end end - test 'has_many_association passes context validation to validate children' do + test 'passes custom context validation to validate children' do pirate = FamousPirate.new pirate.famous_ships << ship = FamousShip.new - assert_equal true, pirate.valid? - assert_equal false, pirate.valid?(:conference) + + assert pirate.valid? + assert_not pirate.valid?(:conference) assert_equal "can't be blank", ship.errors[:name].first end end -- cgit v1.2.3