diff options
author | Azul <azul@leap.se> | 2013-04-02 12:45:58 +0200 |
---|---|---|
committer | Azul <azul@leap.se> | 2013-04-09 09:01:34 +0200 |
commit | 2bd36ec96d42f0b4585a15759f33ff7f89075dcc (patch) | |
tree | bc523084497325e43a373babc887a1c06f19b327 /core/lib/extensions | |
parent | 08ce330fd3676ba0b51d604a2aa653c680fffea5 (diff) |
return token on successful login via api
Diffstat (limited to 'core/lib/extensions')
-rw-r--r-- | core/lib/extensions/testing.rb | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/core/lib/extensions/testing.rb b/core/lib/extensions/testing.rb index 925c023..aad7fc1 100644 --- a/core/lib/extensions/testing.rb +++ b/core/lib/extensions/testing.rb @@ -14,10 +14,17 @@ module LeapWebCore get_response.headers["Content-Disposition"] end + def json_response + response = JSON.parse(get_response.body) + response.respond_to?(:with_indifferent_access) ? + response.with_indifferent_access : + response + end + def assert_json_response(object) if object.is_a? Hash object.stringify_keys! if object.respond_to? :stringify_keys! - assert_equal object, JSON.parse(get_response.body) + assert_equal object, json_response else assert_equal object.to_json, get_response.body end |