From a3fb4722994a5bc6ea016ac2bbe69faab6104484 Mon Sep 17 00:00:00 2001 From: Mauro George Date: Tue, 22 Dec 2015 20:11:51 -0200 Subject: [PATCH] Assert with a non existent file using Regexp In the RBX and Ruby the Errno::ENOENT are different. This patch uses a regexp this way we can handle both platforms. --- test/active_model_serializers/test/schema_test.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/active_model_serializers/test/schema_test.rb b/test/active_model_serializers/test/schema_test.rb index 05234bb4c..161284372 100644 --- a/test/active_model_serializers/test/schema_test.rb +++ b/test/active_model_serializers/test/schema_test.rb @@ -102,14 +102,14 @@ def test_that_assert_with_a_custom_schema_directory end def test_with_a_non_existent_file - message = 'No such file or directory - No Schema file at test/support/schemas/non-existent.json' + message = %r{.* - No Schema file at test/support/schemas/non-existent.json} get :show error = assert_raises ActiveModelSerializers::Test::Schema::MissingSchema do assert_response_schema('non-existent.json') end - assert_equal(message, error.message) + assert_match(message, error.message) end def test_that_raises_with_a_invalid_json_body