summaryrefslogtreecommitdiff
path: root/core/lib/extensions/testing.rb
blob: 14a56987c75acf7b2712a9d0e97a7365baaf35cb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
module LeapWebCore
  module AssertResponses

    def assert_attachement_filename(name)
      assert_equal %Q(attachment; filename="#{name}"),
        @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)
    end

  end
end

class ::ActionController::TestCase
  include LeapWebCore::AssertResponses
end

class ::ActionDispatch::IntegrationTest
  include LeapWebCore::AssertResponses
end