webrat/spec/integration/sinatra/test/webrat_test.rb

27 lines
665 B
Ruby
Raw Normal View History

2008-12-29 08:41:50 +00:00
require File.dirname(__FILE__) + "/test_helper"
class WebratTest < Test::Unit::TestCase
def test_visits_pages
visit "/"
assert response_body.include?("visit")
click_link "there"
assert response_body.include?('<form method="post" action="/go">')
end
def test_submits_form
visit "/go"
fill_in "Name", :with => "World"
fill_in "Email", :with => "world@example.org"
2008-12-29 08:41:50 +00:00
click_button "Submit"
assert response_body.include?("Hello, World")
assert response_body.include?("Your email is: world@example.org")
2008-12-29 08:41:50 +00:00
end
def test_follows_redirects
visit "/redirect"
assert response_body.include?("visit")
end
2008-12-29 08:41:50 +00:00
end