diff options
author | jessib <jessib@riseup.net> | 2012-11-12 10:48:40 -0800 |
---|---|---|
committer | jessib <jessib@riseup.net> | 2012-11-12 10:48:40 -0800 |
commit | 347c1d73c855cfad8c37e8a0bd98a60831151812 (patch) | |
tree | 104c89712d9a1f7d7eefd49187a2f6bbc70a33ce /core/lib | |
parent | 67cb22d50193a58e4697549d9ce8a22e790a7a0d (diff) | |
parent | fe8b49232d31681667badaaeff7aa4d0a40445ea (diff) |
Merge branch 'develop' into help_develop
Conflicts:
help/test/functional/tickets_controller_test.rb
users/test/functional/application_controller_test.rb
users/test/support/auth_test_helper.rb
Diffstat (limited to 'core/lib')
-rw-r--r-- | core/lib/extensions/testing.rb | 13 |
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 |