Permalink
Browse files

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.
  • Loading branch information...
1 parent de804e9 commit c5888508685c3a19413bb3158ff1c53649f5957c @carlosantoniodasilva carlosantoniodasilva committed May 3, 2014
Showing with 4 additions and 3 deletions.
  1. +4 −3 activerecord/test/cases/associations/has_many_associations_test.rb
@@ -1886,11 +1886,12 @@ def test_collection_association_with_private_kernel_method
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

0 comments on commit c588850

Please sign in to comment.