2008-12-29 08:41:50 +00:00
|
|
|
require File.dirname(__FILE__) + "/test_helper"
|
2009-02-22 00:07:15 +00:00
|
|
|
require File.dirname(__FILE__) + "/../classic_app"
|
2008-12-29 08:41:50 +00:00
|
|
|
|
2009-02-22 00:07:15 +00:00
|
|
|
class MyClassicAppTest < Test::Unit::TestCase
|
2008-12-29 08:41:50 +00:00
|
|
|
def test_visits_pages
|
|
|
|
visit "/"
|
|
|
|
assert response_body.include?("visit")
|
|
|
|
|
|
|
|
click_link "there"
|
|
|
|
assert response_body.include?('<form method="post" action="/go">')
|
|
|
|
end
|
2009-01-05 04:56:52 +00:00
|
|
|
|
2008-12-29 08:41:50 +00:00
|
|
|
def test_submits_form
|
|
|
|
visit "/go"
|
|
|
|
fill_in "Name", :with => "World"
|
2009-01-01 14:42:05 +00:00
|
|
|
fill_in "Email", :with => "world@example.org"
|
2008-12-29 08:41:50 +00:00
|
|
|
click_button "Submit"
|
2009-01-05 04:56:52 +00:00
|
|
|
|
2008-12-29 08:41:50 +00:00
|
|
|
assert response_body.include?("Hello, World")
|
2009-01-01 14:42:05 +00:00
|
|
|
assert response_body.include?("Your email is: world@example.org")
|
2008-12-29 08:41:50 +00:00
|
|
|
end
|
2009-01-05 04:56:52 +00:00
|
|
|
|
2009-01-17 22:13:20 +00:00
|
|
|
def test_check_value_of_field
|
|
|
|
visit "/"
|
|
|
|
assert field_labeled("Prefilled").value, "text"
|
|
|
|
end
|
2009-02-22 00:07:15 +00:00
|
|
|
|
2009-01-05 04:56:52 +00:00
|
|
|
def test_follows_internal_redirects
|
|
|
|
visit "/internal_redirect"
|
2009-01-05 03:34:47 +00:00
|
|
|
assert response_body.include?("visit")
|
|
|
|
end
|
2009-01-05 04:56:52 +00:00
|
|
|
|
|
|
|
def test_does_not_follow_external_redirects
|
|
|
|
visit "/external_redirect"
|
|
|
|
assert response_code == 302
|
|
|
|
end
|
2008-12-29 08:41:50 +00:00
|
|
|
end
|