aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel/test
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2015-03-29 20:11:25 -0300
committerRafael Mendonça França <rafaelmfranca@gmail.com>2015-03-29 20:11:25 -0300
commit77d9a8e3da27e61cb648837fb870863a391f0d31 (patch)
tree27f1969f7cabfd36cc6ab18fbb03f8c37913d8ed /activemodel/test
parent01421d5b6259fae07c799d90b58b2258eaa243c9 (diff)
parent1c341eb7cbaeb52435f14c2595e391bfb2e5e38b (diff)
downloadrails-77d9a8e3da27e61cb648837fb870863a391f0d31.tar.gz
rails-77d9a8e3da27e61cb648837fb870863a391f0d31.tar.bz2
rails-77d9a8e3da27e61cb648837fb870863a391f0d31.zip
Merge pull request #19585 from sgrif/sg-deprecate-tokenizer
Deprecate the `:tokenizer` option to `validates_length_of`
Diffstat (limited to 'activemodel/test')
-rw-r--r--activemodel/test/cases/validations/length_validation_test.rb20
1 files changed, 16 insertions, 4 deletions
diff --git a/activemodel/test/cases/validations/length_validation_test.rb b/activemodel/test/cases/validations/length_validation_test.rb
index 209903898e..ee901b75fb 100644
--- a/activemodel/test/cases/validations/length_validation_test.rb
+++ b/activemodel/test/cases/validations/length_validation_test.rb
@@ -319,8 +319,14 @@ class LengthValidationTest < ActiveModel::TestCase
end
def test_validates_length_of_with_block
- Topic.validates_length_of :content, minimum: 5, too_short: "Your essay must be at least %{count} words.",
- tokenizer: lambda {|str| str.scan(/\w+/) }
+ assert_deprecated do
+ Topic.validates_length_of(
+ :content,
+ minimum: 5,
+ too_short: "Your essay must be at least %{count} words.",
+ tokenizer: lambda {|str| str.scan(/\w+/) },
+ )
+ end
t = Topic.new(content: "this content should be long enough")
assert t.valid?
@@ -332,8 +338,14 @@ class LengthValidationTest < ActiveModel::TestCase
def test_validates_length_of_with_symbol
- Topic.validates_length_of :content, minimum: 5, too_short: "Your essay must be at least %{count} words.",
- tokenizer: :my_word_tokenizer
+ assert_deprecated do
+ Topic.validates_length_of(
+ :content,
+ minimum: 5,
+ too_short: "Your essay must be at least %{count} words.",
+ tokenizer: :my_word_tokenizer,
+ )
+ end
t = Topic.new(content: "this content should be long enough")
assert t.valid?