aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel/test
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2016-10-10 20:29:24 -0300
committerRafael Mendonça França <rafaelmfranca@gmail.com>2016-10-10 20:29:24 -0300
commit6a78e0ecd6122a6b1be9a95e6c4e21e10e429513 (patch)
tree0fd10f3e7af3101c3067df8da0f7c6675c30f871 /activemodel/test
parent9de6457ab0767ebab7f2c8bc583420fda072e2bd (diff)
downloadrails-6a78e0ecd6122a6b1be9a95e6c4e21e10e429513.tar.gz
rails-6a78e0ecd6122a6b1be9a95e6c4e21e10e429513.tar.bz2
rails-6a78e0ecd6122a6b1be9a95e6c4e21e10e429513.zip
Removed deprecated :tokenizer in the length validator
Diffstat (limited to 'activemodel/test')
-rw-r--r--activemodel/test/cases/validations/length_validation_test.rb36
-rw-r--r--activemodel/test/models/topic.rb4
2 files changed, 0 insertions, 40 deletions
diff --git a/activemodel/test/cases/validations/length_validation_test.rb b/activemodel/test/cases/validations/length_validation_test.rb
index ade185c179..62d9eaa346 100644
--- a/activemodel/test/cases/validations/length_validation_test.rb
+++ b/activemodel/test/cases/validations/length_validation_test.rb
@@ -318,42 +318,6 @@ class LengthValidationTest < ActiveModel::TestCase
assert_equal ["is the wrong length (should be 5 characters)"], t.errors["title"]
end
- def test_validates_length_of_with_block
- 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?
-
- t.content = "not long enough"
- assert t.invalid?
- assert t.errors[:content].any?
- assert_equal ["Your essay must be at least 5 words."], t.errors[:content]
- end
-
- def test_validates_length_of_with_symbol
- 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?
-
- t.content = "not long enough"
- assert t.invalid?
- assert t.errors[:content].any?
- assert_equal ["Your essay must be at least 5 words."], t.errors[:content]
- end
-
def test_validates_length_of_for_integer
Topic.validates_length_of(:approved, is: 4)
diff --git a/activemodel/test/models/topic.rb b/activemodel/test/models/topic.rb
index 3924741acc..192786c096 100644
--- a/activemodel/test/models/topic.rb
+++ b/activemodel/test/models/topic.rb
@@ -36,8 +36,4 @@ class Topic
def my_validation_with_arg(attr)
errors.add attr, "is missing" unless send(attr)
end
-
- def my_word_tokenizer(str)
- str.scan(/\w+/)
- end
end