Sha256: a61ee0ae21b2fba70df1ee6485e642b6e3596281a6c2eded389e9111578942de

Contents?: true

Size: 738 Bytes

Versions: 2

Compression:

Stored size: 738 Bytes

Contents

require 'helper'

class TestMechanizeFormCheckBox < Test::Unit::TestCase

  def setup
    @agent = Mechanize.new
    @page = @agent.get('http://localhost/tc_checkboxes.html')
  end

  def test_check
    form = @page.forms.first

    form.checkbox_with(:name => 'green').check

    assert(form.checkbox_with(:name => 'green').checked)

    %w{ red blue yellow brown }.each do |color|
      assert_equal(false, form.checkbox_with(:name => color).checked)
    end
  end

  def test_uncheck
    form = @page.forms.first

    checkbox = form.checkbox_with(:name => 'green')

    checkbox.check

    assert form.checkbox_with(:name => 'green').checked

    checkbox.uncheck

    assert !form.checkbox_with(:name => 'green').checked
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mechanize-2.0 test/test_mechanize_form_check_box.rb
mechanize-2.0.pre.2 test/test_mechanize_form_check_box.rb