mirror of
https://github.com/teamcapybara/capybara.git
synced 2022-11-09 12:08:07 -05:00
Follow redirects for links
This commit is contained in:
parent
eef4e74a9f
commit
a2ee724e2d
4 changed files with 19 additions and 1 deletions
|
@ -119,6 +119,7 @@ class Webcat::Driver::RackTest
|
|||
|
||||
def visit(path)
|
||||
get(path)
|
||||
follow_redirect! while response.redirect?
|
||||
cache_body
|
||||
end
|
||||
|
||||
|
|
|
@ -49,6 +49,11 @@ shared_examples_for "session" do
|
|||
end.should raise_error(Webcat::ElementNotFound)
|
||||
end
|
||||
end
|
||||
|
||||
it "should follow redirects" do
|
||||
@session.click_link('Redirect')
|
||||
@session.body.should include('You landed')
|
||||
end
|
||||
end
|
||||
|
||||
describe '#click_button' do
|
||||
|
|
|
@ -29,6 +29,18 @@ class TestApp < Sinatra::Base
|
|||
erb :form
|
||||
end
|
||||
|
||||
get '/redirect' do
|
||||
redirect '/redirect_again'
|
||||
end
|
||||
|
||||
get '/redirect_again' do
|
||||
redirect '/landed'
|
||||
end
|
||||
|
||||
get '/landed' do
|
||||
"You landed"
|
||||
end
|
||||
|
||||
post '/form' do
|
||||
params[:form].to_yaml
|
||||
end
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
<p>
|
||||
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum
|
||||
dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident,
|
||||
dolore eu fugiat <a href="/redirect">Redirect</a> pariatur. Excepteur sint occaecat cupidatat non proident,
|
||||
sunt in culpa qui officia deserunt mollit anim id est laborum.
|
||||
</p>
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue