Merge commit 'joshknowles/master'
This commit is contained in:
commit
2ead102f54
@ -90,9 +90,13 @@ module ActionController #:nodoc:
|
|||||||
|
|
||||||
def follow_redirect_with_headers(h = {})
|
def follow_redirect_with_headers(h = {})
|
||||||
raise "Not a redirect! #{@status} #{@status_message}" unless redirect?
|
raise "Not a redirect! #{@status} #{@status_message}" unless redirect?
|
||||||
h['HTTP_REFERER'] = current_url if current_url
|
|
||||||
|
|
||||||
get(interpret_uri(headers["location"].first), {}, h)
|
h['HTTP_REFERER'] = request.url
|
||||||
|
|
||||||
|
location = headers["location"]
|
||||||
|
location = location.first if location.is_a?(Array)
|
||||||
|
|
||||||
|
get(location, {}, h)
|
||||||
status
|
status
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -131,6 +131,7 @@ describe ActionController::Integration::Session do
|
|||||||
before :each do
|
before :each do
|
||||||
Webrat.configuration.mode = :rails
|
Webrat.configuration.mode = :rails
|
||||||
@integration_session = ActionController::Integration::Session.new
|
@integration_session = ActionController::Integration::Session.new
|
||||||
|
@integration_session.stub!(:request => mock("request", :url => "http://source.url/"))
|
||||||
@integration_session.stub!(:response => mock("response"))
|
@integration_session.stub!(:response => mock("response"))
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -167,8 +168,6 @@ describe ActionController::Integration::Session do
|
|||||||
end
|
end
|
||||||
|
|
||||||
it "should set the HTTP referer header" do
|
it "should set the HTTP referer header" do
|
||||||
@integration_session.stub!(:current_url).and_return "http://source.url/"
|
|
||||||
|
|
||||||
headers = {}
|
headers = {}
|
||||||
|
|
||||||
@integration_session.follow_redirect_with_headers(headers)
|
@integration_session.follow_redirect_with_headers(headers)
|
||||||
|
Loading…
Reference in New Issue
Block a user