aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/associations/has_many_associations_test.rb
diff options
context:
space:
mode:
authorCarlos Antonio da Silva <carlosantoniodasilva@gmail.com>2014-05-03 14:31:00 -0300
committerCarlos Antonio da Silva <carlosantoniodasilva@gmail.com>2014-05-03 14:32:09 -0300
commitc5888508685c3a19413bb3158ff1c53649f5957c (patch)
tree07184c6add5c29de8026ac808e1517d9c6c3e815 /activerecord/test/cases/associations/has_many_associations_test.rb
parentde804e90d4f1af6c52012c78d82de6358574d0cd (diff)
downloadrails-c5888508685c3a19413bb3158ff1c53649f5957c.tar.gz
rails-c5888508685c3a19413bb3158ff1c53649f5957c.tar.bz2
rails-c5888508685c3a19413bb3158ff1c53649f5957c.zip
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.
Diffstat (limited to 'activerecord/test/cases/associations/has_many_associations_test.rb')
-rw-r--r--activerecord/test/cases/associations/has_many_associations_test.rb7
1 files changed, 4 insertions, 3 deletions
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