aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel/test/models
diff options
context:
space:
mode:
authorbogdanvlviv <bogdanvlviv@gmail.com>2017-11-05 22:25:37 +0000
committerbogdanvlviv <bogdanvlviv@gmail.com>2017-11-06 23:07:51 +0000
commit3ff2c158372bce45ea46bd3b49c49022a4259aba (patch)
tree6c8621875084442bd6e6b6f99fa6d5ce9282de29 /activemodel/test/models
parente617fb57f5a388d5f0a47fd5e576588dd10066b0 (diff)
downloadrails-3ff2c158372bce45ea46bd3b49c49022a4259aba.tar.gz
rails-3ff2c158372bce45ea46bd3b49c49022a4259aba.tar.bz2
rails-3ff2c158372bce45ea46bd3b49c49022a4259aba.zip
Add cases to test combining validation conditions
- Test condition that is defined by array of conditions - Test condition that is defined by combining :if and :unless - Test local condition that is defined by :if - Test local condition that is defined by :unless See http://edgeguides.rubyonrails.org/active_record_validations.html#combining-validation-conditions
Diffstat (limited to 'activemodel/test/models')
-rw-r--r--activemodel/test/models/person.rb4
-rw-r--r--activemodel/test/models/topic.rb2
2 files changed, 5 insertions, 1 deletions
diff --git a/activemodel/test/models/person.rb b/activemodel/test/models/person.rb
index b61fdf76b1..8dd8ceadad 100644
--- a/activemodel/test/models/person.rb
+++ b/activemodel/test/models/person.rb
@@ -9,6 +9,10 @@ class Person
def condition_is_true
true
end
+
+ def condition_is_false
+ false
+ end
end
class Person::Gender
diff --git a/activemodel/test/models/topic.rb b/activemodel/test/models/topic.rb
index 2f4e92c3b2..b0af00ee45 100644
--- a/activemodel/test/models/topic.rb
+++ b/activemodel/test/models/topic.rb
@@ -23,7 +23,7 @@ class Topic
true
end
- def condition_is_true_but_its_not
+ def condition_is_false
false
end