summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorAzul <azul@leap.se>2012-11-12 19:42:00 +0100
committerAzul <azul@leap.se>2012-11-12 19:42:00 +0100
commita0ba5ec9c705a74b86fdb558436fb05103bf88e3 (patch)
tree22e0562166e38eb84dc20c8e7addf3089b3af13c /core
parent05ea71016fd54a14159c72299c25efbdc2f177bc (diff)
parentfe8b49232d31681667badaaeff7aa4d0a40445ea (diff)
Merge branch 'develop' into feature-client-side-validations
Conflicts: Gemfile.lock
Diffstat (limited to 'core')
-rw-r--r--core/lib/extensions/testing.rb13
1 files changed, 10 insertions, 3 deletions
diff --git a/core/lib/extensions/testing.rb b/core/lib/extensions/testing.rb
index 14a5698..86a059f 100644
--- a/core/lib/extensions/testing.rb
+++ b/core/lib/extensions/testing.rb
@@ -1,15 +1,22 @@
module LeapWebCore
module AssertResponses
+ # response that works with different TestCases:
+ # ActionController::TestCase has @response
+ # ActionDispatch::IntegrationTest has @response
+ # Rack::Test::Methods defines last_response
+ def get_response
+ @response || last_response
+ end
+
def assert_attachement_filename(name)
assert_equal %Q(attachment; filename="#{name}"),
- @response.headers["Content-Disposition"]
+ get_response.headers["Content-Disposition"]
end
-
def assert_json_response(object)
object.stringify_keys! if object.respond_to? :stringify_keys!
- assert_equal object, JSON.parse(@response.body)
+ assert_equal object, JSON.parse(get_response.body)
end
end