diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2012-07-20 14:10:25 -0300 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2012-07-20 14:10:25 -0300 |
commit | 770fa81bbad8a77b41a1b5af3c926e6652acccd6 (patch) | |
tree | 4ba2f7b7450dab866709a13e93bc03f94dd25495 /activemodel/test | |
parent | 53edd3268461a063979221f896c77f1b42edda67 (diff) | |
download | rails-770fa81bbad8a77b41a1b5af3c926e6652acccd6.tar.gz rails-770fa81bbad8a77b41a1b5af3c926e6652acccd6.tar.bz2 rails-770fa81bbad8a77b41a1b5af3c926e6652acccd6.zip |
Don't pass `:within` option to the i18n
Diffstat (limited to 'activemodel/test')
-rw-r--r-- | activemodel/test/cases/validations/i18n_validation_test.rb | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/activemodel/test/cases/validations/i18n_validation_test.rb b/activemodel/test/cases/validations/i18n_validation_test.rb index bb751cf9c5..4f8b7327c0 100644 --- a/activemodel/test/cases/validations/i18n_validation_test.rb +++ b/activemodel/test/cases/validations/i18n_validation_test.rb @@ -159,6 +159,17 @@ class I18nValidationTest < ActiveModel::TestCase end end + # validates_inclusion_of using :within w/ mocha + + COMMON_CASES.each do |name, validation_options, generate_message_options| + test "validates_inclusion_of using :within on generated message #{name}" do + Person.validates_inclusion_of :title, validation_options.merge(:within => %w(a b c)) + @person.title = 'z' + @person.errors.expects(:generate_message).with(:title, :inclusion, generate_message_options.merge(:value => 'z')) + @person.valid? + end + end + # validates_exclusion_of w/ mocha COMMON_CASES.each do |name, validation_options, generate_message_options| @@ -170,6 +181,17 @@ class I18nValidationTest < ActiveModel::TestCase end end + # validates_exclusion_of using :within w/ mocha + + COMMON_CASES.each do |name, validation_options, generate_message_options| + test "validates_exclusion_of using :within generated message #{name}" do + Person.validates_exclusion_of :title, validation_options.merge(:within => %w(a b c)) + @person.title = 'a' + @person.errors.expects(:generate_message).with(:title, :exclusion, generate_message_options.merge(:value => 'a')) + @person.valid? + end + end + # validates_numericality_of without :only_integer w/ mocha COMMON_CASES.each do |name, validation_options, generate_message_options| |