Added specs for back redirects

This commit is contained in:
Your Name 2010-02-12 14:41:41 +01:00
parent 2839de3769
commit 00c6e7df55
4 changed files with 15 additions and 4 deletions

View File

@ -371,6 +371,7 @@ The following people have dedicated their time and effort to Capybara:
* Graham Ashton
* Joseph Wilk
* Matt Wynne
* Piotr Sarnacki
== License:

View File

@ -75,6 +75,11 @@ shared_examples_for "click_link" do
@session.body.should include('You landed')
end
it "should follow redirects" do
@session.click_link('BackToMyself')
@session.body.should include('This is a test')
end
it "should do nothing on anchor links" do
@session.fill_in("test_field", :with => 'blah')
@session.click_link('Anchor')

View File

@ -38,14 +38,18 @@ class TestApp < Sinatra::Base
nil
end
get '/:view' do |view|
erb view.to_sym
end
post '/redirect' do
redirect '/redirect_again'
end
get '/redirect_back' do
redirect back
end
get '/:view' do |view|
erb view.to_sym
end
post '/form' do
'<pre id="results">' + params[:form].to_yaml + '</pre>'
end

View File

@ -17,6 +17,7 @@
<p>
<input type="text" id="test_field" value="monkey"/>
<a href="/redirect_back">BackToMyself</a>
<a title="twas a fine link" href="/redirect">A link came first</a>
<a title="a fine link" href="/with_simple_html">A link</a>
<a>No Href</a>