From 5d18e8c396181ee8fab3f8579bc19abaee106d52 Mon Sep 17 00:00:00 2001 From: Azul Date: Thu, 24 Mar 2016 11:39:22 +0100 Subject: test: flash now has string keys --- test/support/assert_responses.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test/support/assert_responses.rb') diff --git a/test/support/assert_responses.rb b/test/support/assert_responses.rb index 7724fb4..98c9ad2 100644 --- a/test/support/assert_responses.rb +++ b/test/support/assert_responses.rb @@ -85,7 +85,7 @@ module AssertResponses assert_json_response('error' => key.to_s, 'message' => message) assert_response status else - assert_equal({:alert => message}, flash.to_hash) + assert_equal({'alert' => message}, flash.to_hash) end end -- cgit v1.2.3 From bef4c747e8a6adbf485dc0f466dbee1d03eab9c0 Mon Sep 17 00:00:00 2001 From: Azul Date: Thu, 24 Mar 2016 21:44:25 +0100 Subject: test: use assert_error_response in functional test This way the changed flash hash still is recognized. Also changed the generic 'no_such_thing' i18n key to more specific 'no_such_user'. The former is very hard to translate as the gender of thing may affect the translation of the 'no such' part. --- test/support/assert_responses.rb | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'test/support/assert_responses.rb') diff --git a/test/support/assert_responses.rb b/test/support/assert_responses.rb index 98c9ad2..6a22642 100644 --- a/test/support/assert_responses.rb +++ b/test/support/assert_responses.rb @@ -71,15 +71,18 @@ module AssertResponses end def assert_login_required - assert_error_response :not_authorized_login, :unauthorized + assert_error_response :not_authorized_login, + status: :unauthorized end def assert_access_denied - assert_error_response :not_authorized, :forbidden + assert_error_response :not_authorized, + status: :forbidden end - def assert_error_response(key, status=nil) - message = I18n.t(key) + def assert_error_response(key, options = {}) + status=options.delete :status + message = I18n.t(key, options) if content_type == 'application/json' status ||= :unprocessable_entity assert_json_response('error' => key.to_s, 'message' => message) -- cgit v1.2.3