diff options
author | yuuji.yaginuma <yuuji.yaginuma@gmail.com> | 2017-08-03 21:51:15 +0900 |
---|---|---|
committer | yuuji.yaginuma <yuuji.yaginuma@gmail.com> | 2017-08-03 21:53:23 +0900 |
commit | 1a2fc2eb7b4eb03463187725150734b6b5140e27 (patch) | |
tree | 3215a7b10fe4a5fb16080e0bd42acb450c04a5ac /railties | |
parent | 5fd50c387bdfc2761859ec7a57477bcd56e93210 (diff) | |
download | rails-1a2fc2eb7b4eb03463187725150734b6b5140e27.tar.gz rails-1a2fc2eb7b4eb03463187725150734b6b5140e27.tar.bz2 rails-1a2fc2eb7b4eb03463187725150734b6b5140e27.zip |
Use `assert_nil` if `value` is nil in `assert_field_default_value`
It is deprecate to specify nil for expect argument of `assert_equal`.
Ref: https://github.com/seattlerb/minitest/commit/922bc9151a622cb3ef0b9f170aa09c3bb72c7eb8
Diffstat (limited to 'railties')
-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 |