Skip to content

Commit

Permalink
prevent caching the decoded response across test requests
Browse files Browse the repository at this point in the history
  • Loading branch information
justinjones committed Jun 12, 2012
1 parent abffe3a commit db539dc
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/rocket_pants/test_helper.rb
Expand Up @@ -13,6 +13,10 @@ module TestHelper
end

module ResponseHelper

def recycle_cached_body!
@_parsed_body = @_decoded_body = nil
end

def parsed_body
@_parsed_body ||= begin
Expand Down Expand Up @@ -70,6 +74,7 @@ def have_decoded_response(value)

# Like process, but automatically adds the api version.
def process(action, parameters = nil, session = nil, flash = nil, http_method = 'GET')
response.recycle_cached_body!
parameters ||= {}
if _default_version.present? && parameters[:version].blank? && parameters['version'].blank?
parameters[:version] = _default_version
Expand All @@ -91,4 +96,4 @@ def normalise_value(value)
end

end
end
end

0 comments on commit db539dc

Please sign in to comment.