diff --git a/test/acceptance/loose_keyword_argument_matching_test.rb b/test/acceptance/loose_keyword_argument_matching_test.rb index 9f4b61b5..ae6fa589 100644 --- a/test/acceptance/loose_keyword_argument_matching_test.rb +++ b/test/acceptance/loose_keyword_argument_matching_test.rb @@ -27,10 +27,9 @@ def test_should_match_hash_parameter_with_keyword_args end end if Mocha::RUBY_V27_PLUS + assert_deprecation_warning_location(test_result, execution_point) assert_deprecation_warning( - test_result, - "Expectation defined at #{execution_point.location} " \ - 'expected keyword arguments (key: 42), but received positional hash ({key: 42})' + test_result, 'expected keyword arguments (key: 42), but received positional hash ({key: 42})' ) end assert_passed(test_result) @@ -47,10 +46,9 @@ def test_should_match_hash_parameter_with_splatted_keyword_args end end if Mocha::RUBY_V27_PLUS + assert_deprecation_warning_location(test_result, execution_point) assert_deprecation_warning( - test_result, - "Expectation defined at #{execution_point.location} " \ - 'expected keyword arguments (key: 42), but received positional hash ({key: 42})' + test_result, 'expected keyword arguments (key: 42), but received positional hash ({key: 42})' ) end assert_passed(test_result) @@ -66,10 +64,9 @@ def test_should_match_positional_and_keyword_args_with_last_positional_hash end end if Mocha::RUBY_V27_PLUS + assert_deprecation_warning_location(test_result, execution_point) assert_deprecation_warning( - test_result, - "Expectation defined at #{execution_point.location} " \ - 'expected positional hash ({key: 42}), but received keyword arguments (key: 42)' + test_result, 'expected positional hash ({key: 42}), but received keyword arguments (key: 42)' ) end assert_passed(test_result) @@ -85,10 +82,9 @@ def test_should_match_last_positional_hash_with_keyword_args end end if Mocha::RUBY_V27_PLUS + assert_deprecation_warning_location(test_result, execution_point) assert_deprecation_warning( - test_result, - "Expectation defined at #{execution_point.location} " \ - 'expected keyword arguments (key: 42), but received positional hash ({key: 42})' + test_result, 'expected keyword arguments (key: 42), but received positional hash ({key: 42})' ) end assert_passed(test_result) @@ -99,4 +95,9 @@ def test_should_match_last_positional_hash_with_keyword_args def assert_deprecation_warning(test_result, expected_warning) assert_includes test_result.last_deprecation_warning, expected_warning end + + def assert_deprecation_warning_location(test_result, execution_point) + expected_location = "Expectation defined at #{execution_point.location}" + assert_deprecation_warning test_result, expected_location + end end