Module: RocketPants::TestHelper::ResponseHelper

Defined in:
lib/rocket_pants/test_helper.rb

Instance Method Summary collapse

Instance Method Details

#decoded_bodyObject



35
36
37
38
39
40
41
42
43
44
# File 'lib/rocket_pants/test_helper.rb', line 35

def decoded_body
  @_decoded_body ||= begin
    decoded = parsed_body
    if decoded.is_a?(Hash)
      Hashie::Mash.new(decoded)
    else
      decoded
    end
  end
end

#parsed_bodyObject



27
28
29
30
31
32
33
# File 'lib/rocket_pants/test_helper.rb', line 27

def parsed_body
  @_parsed_body ||= begin
    ActiveSupport::JSON.decode(body)
  rescue StandardError => e
    nil
  end
end

#recycle_cached_body!Object



23
24
25
# File 'lib/rocket_pants/test_helper.rb', line 23

def recycle_cached_body!
  @_parsed_body = @_decoded_body = nil
end