Module: RocketPants::TestHelper::ResponseHelper

Defined in:
lib/rocket_pants/test_helper.rb

Instance Method Summary collapse

Instance Method Details

#decoded_bodyObject



31
32
33
34
35
36
37
38
39
40
# File 'lib/rocket_pants/test_helper.rb', line 31

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



23
24
25
26
27
28
29
# File 'lib/rocket_pants/test_helper.rb', line 23

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

#recycle_cached_body!Object



19
20
21
# File 'lib/rocket_pants/test_helper.rb', line 19

def recycle_cached_body!
  @_parsed_body = @_decoded_body = nil
end