From 6a78e0ecd6122a6b1be9a95e6c4e21e10e429513 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20Mendon=C3=A7a=20Fran=C3=A7a?= Date: Mon, 10 Oct 2016 20:29:24 -0300 Subject: Removed deprecated :tokenizer in the length validator --- .../cases/validations/length_validation_test.rb | 36 ---------------------- activemodel/test/models/topic.rb | 4 --- 2 files changed, 40 deletions(-) (limited to 'activemodel/test') 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 -- cgit v1.2.3