From 1a2fc2eb7b4eb03463187725150734b6b5140e27 Mon Sep 17 00:00:00 2001 From: "yuuji.yaginuma" Date: Thu, 3 Aug 2017 21:51:15 +0900 Subject: 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 --- railties/lib/rails/generators/testing/assertions.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'railties/lib/rails/generators/testing') 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 -- cgit v1.2.3