Sha256: 25bc1acb7152a5f0c272332f4859e9f3fcdd437bb33a161566e393bcd81ab0a5

Contents?: true

Size: 1.68 KB

Versions: 14

Compression:

Stored size: 1.68 KB

Contents

require 'test_helper'

class WebratTest < ActionController::IntegrationTest

  test "should visit fully qualified urls" do
    visit root_url(:host => "chunkybacon.example.com")
    assert_equal "chunkybacon", request.subdomains.first
  end

  test "should visit pages" do
    visit root_path
    assert_contain("Webrat Form")
  end

  test "should submit forms" do
    visit root_path
    fill_in "Text field", :with => "Hello"
    check "TOS"
    select "January"
    click_button "Test"
  end

  test "should check the value of a field" do
    visit "/"
    assert field_labeled("Prefilled").value, "text"
  end

  test "should not carry params through redirects" do
    visit before_redirect_form_path
    fill_in "Text field", :with => "value"
    click_button

    assert response.body !~ /value/
    assert response.body =~ /custom_param/
  end

  test "should follow internal redirects" do
    visit internal_redirect_path
    assert !response.redirect?
    assert response.body.include?("OK")
  end

  test "should not follow external redirects" do
    visit external_redirect_path
    assert response.redirect?
  end

  test "should click link by text" do
    visit internal_redirect_path
    click_link "Test Link Text"
    assert_contain("Webrat Form")
  end

  test "should click link by id" do
    visit internal_redirect_path
    click_link "link_id"
    assert_contain("Webrat Form")
  end

  test "should be able to assert xpath" do
    visit root_path
    assert_have_xpath "//h1"
  end

  test "should be able to assert selector" do
    visit root_path
    assert_have_selector "h1"
  end
  
#  test "should be able to assert have tag" do
#    visit root_path
#    assert_have_tag "h1"
#  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

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