1
0
Fork 0
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:
Jonas Nicklas 2009-11-12 19:02:00 +01:00
parent a2ee724e2d
commit 8a39001a44
4 changed files with 16 additions and 0 deletions

View file

@ -125,6 +125,7 @@ class Webcat::Driver::RackTest
def submit(path, attributes)
post(path, attributes)
follow_redirect! while response.redirect?
cache_body
end

View file

@ -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

View file

@ -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

View file

@ -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>