ActionController::TestRequest#recycle! should set @protocol to nil #2654

Closed
dmajda opened this Issue Aug 23, 2011 · 2 comments

Comments

Projects
None yet
2 participants
Contributor

dmajda commented Aug 23, 2011

ActionController::TestRequest#recycle! should set @protocol to nil. Currently it does not do so and the protocol gets carried over when there are two or more requests in functional tests. This is a problem when e.g. the first request is HTTP and the second request is HTTPS:

def test_foo
  get :foo # Calling request.protocol in the controller's "foo" action returns "http://".

  @request.env["HTTPS"] = "on"
  get :foo # Calling request.protocol in the controller's "foo" action still returns "http://"!
end

Tested with Rails 3.1 RC6. This is aregression against 2.3.x.

Owner

pixeltrix commented Aug 23, 2011

Is it a regression against 3.0.x?

Contributor

dmajda commented Aug 23, 2011

@pixeltrix: Judging from the code it is a regression because 3.0.x does not use the @protocol variable for caching at all. Didn't test though.

pixeltrix was assigned Aug 23, 2011

@pixeltrix pixeltrix added a commit that referenced this issue Aug 23, 2011

@pixeltrix pixeltrix Add failing test case for #2654
(cherry picked from commit ebea387)
586b284

pixeltrix closed this in 94a7803 Aug 23, 2011

@vishnuatrai vishnuatrai pushed a commit to castlerock/rails that referenced this issue Aug 23, 2011

@dmajda @pixeltrix dmajda + pixeltrix Make ActionController::TestCase#recycle! set @protocol to nil
This ensures that the protocol does not get carried over when there are
two or more requests in functional tests. This was a problem when e.g.
the first request was HTTP and the second request was HTTPS.

Closes #2654.

Signed-off-by: Andrew White <andyw@pixeltrix.co.uk>
68a13ed

@arunagw arunagw pushed a commit to arunagw/rails that referenced this issue Aug 25, 2011

@dmajda @spastorino dmajda + spastorino Make ActionController::TestCase#recycle! set @protocol to nil
This ensures that the protocol does not get carried over when there are
two or more requests in functional tests. This was a problem when e.g.
the first request was HTTP and the second request was HTTPS.

Closes #2654.

Signed-off-by: Andrew White <andyw@pixeltrix.co.uk>
621fe98

@tenderlove tenderlove added a commit that referenced this issue Aug 30, 2011

@tenderlove tenderlove Merge branch '3-1-0' into 3-1-stable
* 3-1-0:
  Configuration changes for asset pipeline: remove config.assets.allow_debugging, add config.assets.compile and config.assets.digest
  Read digests of assets from manifest.yml if config.assets.manifest is on
  let SDoc add a link to the source code in GitHub for each method
  Documentation fixes
  bumping to 3.1.0.rc8
  bumping to 3.1.0.rc7
  Update Rails 3.1 CHANGELOGs
  Bump rack-cache, rack-test, rack-mount and sprockets up
  clear and disable query cache when an exception is raised from called middleware
  assert_no_match
  deletes spurious arrow
  use sdoc to generate the API
  Don't modify params in place - fixes #2624
  the command line guide is good to go
  `load` should also return the value from `super`
  require needs to return true or false. thank you Ryan "zenspider" Davis
  bumping bcrypt-ruby requirement
  Make ActionController::TestCase#recycle! set @protocol to nil
  Add failing test case for #2654

Conflicts:
	activerecord/test/cases/query_cache_test.rb
602a3c2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment