webrat/spec/integration/rack/test/webrat_rack_test.rb

41 lines
920 B
Ruby
Raw Normal View History

require File.dirname(__FILE__) + "/helper"
2009-04-15 02:19:57 +00:00
class WebratRackTest < Test::Unit::TestCase
def test_visits_pages
visit "/"
click_link "there"
2009-05-11 05:27:04 +00:00
assert_have_tag("form[@method='post'][@action='/go']")
2009-04-15 02:19:57 +00:00
end
2009-05-11 05:27:04 +00:00
# def test_submits_form
# visit "/go"
# fill_in "Name", :with => "World"
# fill_in "Email", :with => "world@example.org"
# click_button "Submit"
#
# assert_contain "Hello, World"
# assert_contain "Your email is: world@example.org"
# end
def test_check_value_of_field
2009-04-15 02:19:57 +00:00
visit "/"
assert_equal field_labeled("Prefilled").value, "text"
2009-04-15 02:19:57 +00:00
end
def test_follows_internal_redirects
visit "/internal_redirect"
assert_contain "visit"
end
2009-05-11 05:27:04 +00:00
def test_does_not_follow_external_redirects
visit "/external_redirect"
assert last_response.redirect?
2009-04-15 02:19:57 +00:00
end
2009-05-11 05:27:04 +00:00
def test_absolute_url_redirect
visit "/absolute_redirect"
assert_contain "spam"
2009-04-15 02:19:57 +00:00
end
end