mirror of
https://github.com/teamcapybara/capybara.git
synced 2022-11-09 12:08:07 -05:00
Follow redirect for button presses
This commit is contained in:
parent
a2ee724e2d
commit
8a39001a44
4 changed files with 16 additions and 0 deletions
|
@ -125,6 +125,7 @@ class Webcat::Driver::RackTest
|
|||
|
||||
def submit(path, attributes)
|
||||
post(path, attributes)
|
||||
follow_redirect! while response.redirect?
|
||||
cache_body
|
||||
end
|
||||
|
||||
|
|
|
@ -125,6 +125,11 @@ shared_examples_for "session" do
|
|||
results['first_name'].should == 'John'
|
||||
end
|
||||
end
|
||||
|
||||
it "should follow redirects" do
|
||||
@session.click_button('Go FAR')
|
||||
@session.body.should include('You landed')
|
||||
end
|
||||
end
|
||||
|
||||
describe "#fill_in" do
|
||||
|
|
|
@ -29,6 +29,10 @@ class TestApp < Sinatra::Base
|
|||
erb :form
|
||||
end
|
||||
|
||||
post '/redirect' do
|
||||
redirect '/redirect_again'
|
||||
end
|
||||
|
||||
get '/redirect' do
|
||||
redirect '/redirect_again'
|
||||
end
|
||||
|
|
|
@ -108,3 +108,9 @@
|
|||
<input type="submit" value="Upload"/>
|
||||
<p>
|
||||
</form>
|
||||
|
||||
<form action="/redirect" method="post">
|
||||
<p>
|
||||
<input type="submit" value="Go FAR"/>
|
||||
</p>
|
||||
</form>
|
||||
|
|
Loading…
Reference in a new issue