diff options
author | Rafael França <rafaelmfranca@gmail.com> | 2016-10-10 21:38:59 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-10-10 21:38:59 -0300 |
commit | c2fa53606d3c98ac8dd079a1e5b22da3290a513b (patch) | |
tree | f6cb51b750c1ab0e725a4ecf41a5386af2b0bd8c /activemodel/test/cases/errors_test.rb | |
parent | 36f6ab2d8e0ef84f520bb6169b61a8d79f222cfc (diff) | |
parent | 6a78e0ecd6122a6b1be9a95e6c4e21e10e429513 (diff) | |
download | rails-c2fa53606d3c98ac8dd079a1e5b22da3290a513b.tar.gz rails-c2fa53606d3c98ac8dd079a1e5b22da3290a513b.tar.bz2 rails-c2fa53606d3c98ac8dd079a1e5b22da3290a513b.zip |
Merge pull request #26755 from rafaelfranca/deprecations
Remove deprecations in Active Model, Action View and Active Job
Diffstat (limited to 'activemodel/test/cases/errors_test.rb')
-rw-r--r-- | activemodel/test/cases/errors_test.rb | 92 |
1 files changed, 0 insertions, 92 deletions
diff --git a/activemodel/test/cases/errors_test.rb b/activemodel/test/cases/errors_test.rb index 95ca1f3969..605ad64e4d 100644 --- a/activemodel/test/cases/errors_test.rb +++ b/activemodel/test/cases/errors_test.rb @@ -79,24 +79,6 @@ class ErrorsTest < ActiveModel::TestCase assert person.errors.empty? end - test "get returns the errors for the provided key" do - errors = ActiveModel::Errors.new(self) - errors[:foo] << "omg" - - assert_deprecated do - assert_equal ["omg"], errors.get(:foo) - end - end - - test "sets the error with the provided key" do - errors = ActiveModel::Errors.new(self) - assert_deprecated do - errors.set(:foo, "omg") - end - - assert_equal({ foo: "omg" }, errors.messages) - end - test "error access is indifferent" do errors = ActiveModel::Errors.new(self) errors[:foo] << "omg" @@ -142,14 +124,6 @@ class ErrorsTest < ActiveModel::TestCase assert_equal ["cannot be nil"], person.errors[:name] end - test "assign error" do - person = Person.new - assert_deprecated do - person.errors[:name] = "should not be nil" - end - assert_equal ["should not be nil"], person.errors[:name] - end - test "add an error message on a specific attribute" do person = Person.new person.errors.add(:name, "cannot be blank") @@ -320,72 +294,6 @@ class ErrorsTest < ActiveModel::TestCase } end - test "add_on_empty generates message" do - person = Person.new - assert_called_with(person.errors, :generate_message, [:name, :empty, {}]) do - assert_deprecated do - person.errors.add_on_empty :name - end - end - end - - test "add_on_empty generates message for multiple attributes" do - person = Person.new - expected_calls = [ [:name, :empty, {}], [:age, :empty, {}] ] - assert_called_with(person.errors, :generate_message, expected_calls) do - assert_deprecated do - person.errors.add_on_empty [:name, :age] - end - end - end - - test "add_on_empty generates message with custom default message" do - person = Person.new - assert_called_with(person.errors, :generate_message, [:name, :empty, { message: "custom" }]) do - assert_deprecated do - person.errors.add_on_empty :name, message: "custom" - end - end - end - - test "add_on_empty generates message with empty string value" do - person = Person.new - person.name = "" - assert_called_with(person.errors, :generate_message, [:name, :empty, {}]) do - assert_deprecated do - person.errors.add_on_empty :name - end - end - end - - test "add_on_blank generates message" do - person = Person.new - assert_called_with(person.errors, :generate_message, [:name, :blank, {}]) do - assert_deprecated do - person.errors.add_on_blank :name - end - end - end - - test "add_on_blank generates message for multiple attributes" do - person = Person.new - expected_calls = [ [:name, :blank, {}], [:age, :blank, {}] ] - assert_called_with(person.errors, :generate_message, expected_calls) do - assert_deprecated do - person.errors.add_on_blank [:name, :age] - end - end - end - - test "add_on_blank generates message with custom default message" do - person = Person.new - assert_called_with(person.errors, :generate_message, [:name, :blank, { message: "custom" }]) do - assert_deprecated do - person.errors.add_on_blank :name, message: "custom" - end - end - end - test "details returns added error detail" do person = Person.new person.errors.add(:name, :invalid) |