diff options
author | Rafael França <rafaelmfranca@gmail.com> | 2018-01-26 13:15:30 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-01-26 13:15:30 -0500 |
commit | 85fcb663363cd27220e8bd3136973cc3408cf7d7 (patch) | |
tree | 8521ed5477f475e1de8bcb89b689bbd3b1abeae8 /activerecord/test/cases/validations_test.rb | |
parent | 8baca31dbe522cb407f0b3b8c8d3d4a6804e5aed (diff) | |
parent | fda1863e1a8c120294c56482631d8254ad6125ff (diff) | |
download | rails-85fcb663363cd27220e8bd3136973cc3408cf7d7.tar.gz rails-85fcb663363cd27220e8bd3136973cc3408cf7d7.tar.bz2 rails-85fcb663363cd27220e8bd3136973cc3408cf7d7.zip |
Merge pull request #31786 from composerinteralia/respond-to-tests
Use respond_to test helpers
Diffstat (limited to 'activerecord/test/cases/validations_test.rb')
-rw-r--r-- | activerecord/test/cases/validations_test.rb | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/activerecord/test/cases/validations_test.rb b/activerecord/test/cases/validations_test.rb index 14623c43d2..6c83bbd15c 100644 --- a/activerecord/test/cases/validations_test.rb +++ b/activerecord/test/cases/validations_test.rb @@ -19,7 +19,7 @@ class ValidationsTest < ActiveRecord::TestCase def test_valid_uses_create_context_when_new r = WrongReply.new r.title = "Wrong Create" - assert_not r.valid? + assert_not_predicate r, :valid? assert r.errors[:title].any?, "A reply with a bad title should mark that attribute as invalid" assert_equal ["is Wrong Create"], r.errors[:title], "A reply with a bad content should contain an error" end @@ -139,7 +139,7 @@ class ValidationsTest < ActiveRecord::TestCase def test_throw_away_typing d = Developer.new("name" => "David", "salary" => "100,000") - assert !d.valid? + assert_not_predicate d, :valid? assert_equal 100, d.salary assert_equal "100,000", d.salary_before_type_cast end @@ -166,7 +166,7 @@ class ValidationsTest < ActiveRecord::TestCase topic = klass.new(wibble: "123-4567") topic.wibble.gsub!("-", "") - assert topic.valid? + assert_predicate topic, :valid? end def test_numericality_validation_checks_against_raw_value @@ -178,9 +178,9 @@ class ValidationsTest < ActiveRecord::TestCase validates_numericality_of :wibble, greater_than_or_equal_to: BigDecimal("97.18") end - assert_not klass.new(wibble: "97.179").valid? - assert_not klass.new(wibble: 97.179).valid? - assert_not klass.new(wibble: BigDecimal("97.179")).valid? + assert_not_predicate klass.new(wibble: "97.179"), :valid? + assert_not_predicate klass.new(wibble: 97.179), :valid? + assert_not_predicate klass.new(wibble: BigDecimal("97.179")), :valid? end def test_acceptance_validator_doesnt_require_db_connection |