Merge commit 'eddd97936'
Conflicts: spec/integration/rails/test/integration/webrat_test.rb
This commit is contained in:
commit
0c9944c4d8
|
@ -273,7 +273,7 @@ For example:
|
||||||
end
|
end
|
||||||
|
|
||||||
def current_host
|
def current_host
|
||||||
URI.parse(current_url).host || "www.example.com"
|
URI.parse(current_url).host || @custom_headers["Host"] || "www.example.com"
|
||||||
end
|
end
|
||||||
|
|
||||||
def response_location_host
|
def response_location_host
|
||||||
|
|
|
@ -25,6 +25,10 @@ class WebratController < ApplicationController
|
||||||
redirect_to "http://google.com"
|
redirect_to "http://google.com"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def host_redirect
|
||||||
|
redirect_to submit_url
|
||||||
|
end
|
||||||
|
|
||||||
def before_redirect_form
|
def before_redirect_form
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@ ActionController::Routing::Routes.draw do |map|
|
||||||
webrat.internal_redirect "/internal_redirect", :action => "internal_redirect"
|
webrat.internal_redirect "/internal_redirect", :action => "internal_redirect"
|
||||||
webrat.external_redirect "/external_redirect", :action => "external_redirect"
|
webrat.external_redirect "/external_redirect", :action => "external_redirect"
|
||||||
webrat.infinite_redirect "/infinite_redirect", :action => "infinite_redirect"
|
webrat.infinite_redirect "/infinite_redirect", :action => "infinite_redirect"
|
||||||
|
webrat.host_redirect "/host_redirect", :action => "host_redirect"
|
||||||
|
|
||||||
webrat.before_redirect_form "/before_redirect_form", :action => "before_redirect_form"
|
webrat.before_redirect_form "/before_redirect_form", :action => "before_redirect_form"
|
||||||
webrat.redirect_to_show_params "/redirect_to_show_params", :action => "redirect_to_show_params"
|
webrat.redirect_to_show_params "/redirect_to_show_params", :action => "redirect_to_show_params"
|
||||||
|
|
|
@ -52,6 +52,25 @@ class WebratTest < ActionController::IntegrationTest
|
||||||
assert response.redirect?
|
assert response.redirect?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
test "should recognize the host header to follow redirects properly" do
|
||||||
|
header "Host", "foo.bar"
|
||||||
|
visit host_redirect_path
|
||||||
|
assert !response.redirect?
|
||||||
|
assert response.body.include?("OK")
|
||||||
|
end
|
||||||
|
|
||||||
|
test "should click link by text" do
|
||||||
|
visit internal_redirect_path
|
||||||
|
click_link "Test Link Text"
|
||||||
|
assert_contain("Webrat Form")
|
||||||
|
end
|
||||||
|
|
||||||
|
test "should click link by id" do
|
||||||
|
visit internal_redirect_path
|
||||||
|
click_link "link_id"
|
||||||
|
assert_contain("Webrat Form")
|
||||||
|
end
|
||||||
|
|
||||||
test "should be able to assert xpath" do
|
test "should be able to assert xpath" do
|
||||||
visit root_path
|
visit root_path
|
||||||
assert_have_xpath "//h1"
|
assert_have_xpath "//h1"
|
||||||
|
|
Loading…
Reference in New Issue