PageRenderTime 52ms CodeModel.GetById 15ms RepoModel.GetById 0ms app.codeStats 0ms

/vendor/bundle/ruby/1.9.1/gems/webrat-0.7.3/spec/integration/sinatra/test/classic_app_test.rb

https://bitbucket.org/sqctest01/sample_app_3_1
Ruby | 38 lines | 31 code | 7 blank | 0 comment | 1 complexity | 16dc43b5ed8e8d46898a50cde8965d71 MD5 | raw file
Possible License(s): GPL-2.0
  1. require "rubygems"
  2. require File.dirname(__FILE__) + "/test_helper"
  3. require File.dirname(__FILE__) + "/../classic_app"
  4. class MyClassicAppTest < Test::Unit::TestCase
  5. def test_visits_pages
  6. visit "/"
  7. assert response_body.include?("visit")
  8. click_link "there"
  9. assert response_body.include?('<form method="post" action="/go">')
  10. end
  11. def test_submits_form
  12. visit "/go"
  13. fill_in "Name", :with => "World"
  14. fill_in "Email", :with => "world@example.org"
  15. click_button "Submit"
  16. assert response_body.include?("Hello, World")
  17. assert response_body.include?("Your email is: world@example.org")
  18. end
  19. def test_check_value_of_field
  20. visit "/"
  21. assert field_labeled("Prefilled").value, "text"
  22. end
  23. def test_follows_internal_redirects
  24. visit "/internal_redirect"
  25. assert response_body.include?("visit")
  26. end
  27. def test_does_not_follow_external_redirects
  28. visit "/external_redirect"
  29. assert response_code == 302
  30. end
  31. end