diff options
author | Rafael França <rafaelmfranca@gmail.com> | 2017-08-04 13:20:43 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-08-04 13:20:43 -0400 |
commit | 6453b0e50aeb46e1eef056c4cd29eaee2ebf9c43 (patch) | |
tree | 7b0f11f6e92716529b3e5200a02117d7e88eea3a /railties/lib/rails | |
parent | 68cf336f0eb6ae58371eba1ac9c7242e280c69ba (diff) | |
parent | 1a2fc2eb7b4eb03463187725150734b6b5140e27 (diff) | |
download | rails-6453b0e50aeb46e1eef056c4cd29eaee2ebf9c43.tar.gz rails-6453b0e50aeb46e1eef056c4cd29eaee2ebf9c43.tar.bz2 rails-6453b0e50aeb46e1eef056c4cd29eaee2ebf9c43.zip |
Merge pull request #30058 from y-yagi/use_assert_nil_if_value_is_nil_in_assert_field_default_value_
Use `assert_nil` if `value` is nil in `assert_field_default_value`
Diffstat (limited to 'railties/lib/rails')
-rw-r--r-- | railties/lib/rails/generators/testing/assertions.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/railties/lib/rails/generators/testing/assertions.rb b/railties/lib/rails/generators/testing/assertions.rb index 1cabf4e28c..9ac70f60c0 100644 --- a/railties/lib/rails/generators/testing/assertions.rb +++ b/railties/lib/rails/generators/testing/assertions.rb @@ -113,7 +113,11 @@ module Rails # # assert_field_default_value :string, "MyString" def assert_field_default_value(attribute_type, value) - assert_equal(value, create_generated_attribute(attribute_type).default) + if value.nil? + assert_nil(create_generated_attribute(attribute_type).default) + else + assert_equal(value, create_generated_attribute(attribute_type).default) + end end end end |