summaryrefslogtreecommitdiff
path: root/core/lib
diff options
context:
space:
mode:
authorjessib <jessib@riseup.net>2013-04-25 10:03:20 -0700
committerjessib <jessib@riseup.net>2013-04-25 10:03:20 -0700
commit15d48c24e529e2f944b026749c5eb35eb4c5cfa7 (patch)
tree071ec86c0fbd85cce8cef0a417423ee8e99c39f0 /core/lib
parent4927abe188c7615fe6844ae0e20144b116a52a99 (diff)
parent53e3198196033f2dd77c09be6919cbef72f3f5d8 (diff)
Merge pull request #40 from azul/feature/token-auth
Token auth with a database of it's own
Diffstat (limited to 'core/lib')
-rw-r--r--core/lib/extensions/testing.rb9
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