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)
|
def submit(path, attributes)
|
||||||
post(path, attributes)
|
post(path, attributes)
|
||||||
|
follow_redirect! while response.redirect?
|
||||||
cache_body
|
cache_body
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -125,6 +125,11 @@ shared_examples_for "session" do
|
||||||
results['first_name'].should == 'John'
|
results['first_name'].should == 'John'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "should follow redirects" do
|
||||||
|
@session.click_button('Go FAR')
|
||||||
|
@session.body.should include('You landed')
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "#fill_in" do
|
describe "#fill_in" do
|
||||||
|
|
|
@ -29,6 +29,10 @@ class TestApp < Sinatra::Base
|
||||||
erb :form
|
erb :form
|
||||||
end
|
end
|
||||||
|
|
||||||
|
post '/redirect' do
|
||||||
|
redirect '/redirect_again'
|
||||||
|
end
|
||||||
|
|
||||||
get '/redirect' do
|
get '/redirect' do
|
||||||
redirect '/redirect_again'
|
redirect '/redirect_again'
|
||||||
end
|
end
|
||||||
|
|
|
@ -108,3 +108,9 @@
|
||||||
<input type="submit" value="Upload"/>
|
<input type="submit" value="Upload"/>
|
||||||
<p>
|
<p>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
<form action="/redirect" method="post">
|
||||||
|
<p>
|
||||||
|
<input type="submit" value="Go FAR"/>
|
||||||
|
</p>
|
||||||
|
</form>
|
||||||
|
|
Loading…
Add table
Reference in a new issue