webrat/spec/integration/sinatra/test/classic_app_test.rb
Simon Rozet 7d7c32256d Support for "modular" Sinatra app style
Since Sinatra 0.9, apps can be ancapsulated in a class ("modular" style)
or be on the top level, just like before ("classic" style)

* http://wiki.github.com/brynary/webrat/sinatra
* http://www.sinatrarb.com/extensions.html
2009-02-28 03:30:25 +01:00

38 lines
953 B
Ruby

require File.dirname(__FILE__) + "/test_helper"
require File.dirname(__FILE__) + "/../classic_app"
class MyClassicAppTest < 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"
click_button "Submit"
assert response_body.include?("Hello, World")
assert response_body.include?("Your email is: world@example.org")
end
def test_check_value_of_field
visit "/"
assert field_labeled("Prefilled").value, "text"
end
def test_follows_internal_redirects
visit "/internal_redirect"
assert response_body.include?("visit")
end
def test_does_not_follow_external_redirects
visit "/external_redirect"
assert response_code == 302
end
end