mirror of
https://github.com/teamcapybara/capybara.git
synced 2022-11-09 12:08:07 -05:00
Add test for 308 redirect
This commit is contained in:
parent
01305380e8
commit
6234454306
3 changed files with 16 additions and 6 deletions
|
@ -396,9 +396,14 @@ Capybara::SpecHelper.spec '#click_button' do
|
|||
expect(@session.current_url).to match(%r{/landed$})
|
||||
end
|
||||
|
||||
it "should follow redirects that maintain method" do
|
||||
it "should follow temporary redirects that maintain method" do
|
||||
@session.click_button('Go 307')
|
||||
expect(@session).to have_content('You post landed: 307')
|
||||
expect(@session).to have_content('You post landed: TWTW')
|
||||
end
|
||||
|
||||
it "should follow permanent redirects that maintain method" do
|
||||
@session.click_button('Go 308')
|
||||
expect(@session).to have_content('You post landed: TWTW')
|
||||
end
|
||||
|
||||
it "should post pack to the same URL when no action given" do
|
||||
|
|
|
@ -42,6 +42,10 @@ class TestApp < Sinatra::Base
|
|||
redirect '/landed', 307
|
||||
end
|
||||
|
||||
post '/redirect_308' do
|
||||
redirect '/landed', 308
|
||||
end
|
||||
|
||||
get '/referer_base' do
|
||||
'<a href="/get_referer">direct link</a>' \
|
||||
'<a href="/redirect_to_get_referer">link via redirect</a>' \
|
||||
|
|
|
@ -552,12 +552,13 @@ New line after and before textarea tag
|
|||
<p>
|
||||
<input type="submit" value="Go FAR"/>
|
||||
</p>
|
||||
</form>
|
||||
|
||||
<form action="/redirect_307" method="post">
|
||||
<input type="hidden" name="form[data]" value="307"/>
|
||||
<input type="hidden" name="form[data]" value="TWTW"/>
|
||||
<p>
|
||||
<input type="submit" value="Go 307"/>
|
||||
<button formaction='/redirect_307'>Go 307</button>
|
||||
</p>
|
||||
<p>
|
||||
<button formaction='/redirect_308'>Go 308</button>
|
||||
</p>
|
||||
</form>
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue