Sha256: a691c3f9de1a0300c82d792c7f0d5f6a1f44e8b1c8c094de6dff023961c454b9

Contents?: true

Size: 898 Bytes

Versions: 14

Compression:

Stored size: 898 Bytes

Contents

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"
    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

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
adva-0.3.2 test/webrat/spec/integration/sinatra/test/webrat_test.rb
adva-0.3.1 test/webrat/spec/integration/sinatra/test/webrat_test.rb
adva-0.3.0 test/webrat/spec/integration/sinatra/test/webrat_test.rb
adva-0.2.4 test/webrat/spec/integration/sinatra/test/webrat_test.rb
adva-0.2.3 test/webrat/spec/integration/sinatra/test/webrat_test.rb
adva-0.2.2 test/webrat/spec/integration/sinatra/test/webrat_test.rb
adva-0.2.1 test/webrat/spec/integration/sinatra/test/webrat_test.rb
adva-0.2.0 test/webrat/spec/integration/sinatra/test/webrat_test.rb
adva-0.1.4 test/webrat/spec/integration/sinatra/test/webrat_test.rb
adva-0.1.3 test/webrat/spec/integration/sinatra/test/webrat_test.rb
adva-0.1.2 test/webrat/spec/integration/sinatra/test/webrat_test.rb
adva-0.1.1 test/webrat/spec/integration/sinatra/test/webrat_test.rb
adva-0.1.0 test/webrat/spec/integration/sinatra/test/webrat_test.rb
adva-0.0.1 test/webrat/spec/integration/sinatra/test/webrat_test.rb