Sha256: 2b582ae536405fc4c5cf6b2033db2ec74407f2d97956c5e9d5d47f84b2dbf697

Contents?: true

Size: 742 Bytes

Versions: 3

Compression:

Stored size: 742 Bytes

Contents

require 'helper'

class TestMechanizeFormCheckBox < MiniTest::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

3 entries across 3 versions & 3 rubygems

Version Path
aai10-mechanize-2.0.1.0 test/test_mechanize_form_check_box.rb
neocoin-mechanize-2.0.2 test/test_mechanize_form_check_box.rb
mechanize-2.0.1 test/test_mechanize_form_check_box.rb