Sha256: 94a6958485805b6defdc70447bbe39c3635a133d0f1b64cc60ff5fd72c085135

Contents?: true

Size: 1.16 KB

Versions: 3

Compression:

Stored size: 1.16 KB

Contents

require "helper"

class TestCheckBoxes < MiniTest::Unit::TestCase
  def test_field
    f = Mechanize::Form::Field.new({'name' => 'a&amp;b'}, 'a&amp;b')
    assert_equal('a&b', f.name)
    assert_equal('a&b', f.value)

    f = Mechanize::Form::Field.new({'name' => 'a&b'}, 'a&b')
    assert_equal('a&b', f.name)
    assert_equal('a&b', f.value)

    f = Mechanize::Form::Field.new({'name' => 'a&#38;b'}, 'a&#38;b')
    assert_equal('a&b', f.name)
    assert_equal('a&b', f.value)
  end

  def test_file_upload
    f = Mechanize::Form::FileUpload.new(fake_node, 'a&amp;b')
    assert_equal('a&b', f.name)
    assert_equal('a&b', f.file_name)

    f = Mechanize::Form::FileUpload.new(fake_node, 'a&b')
    assert_equal('a&b', f.name)
    assert_equal('a&b', f.file_name)
  end

  def test_image_button
    f = Mechanize::Form::ImageButton.new({'name' => 'a&amp;b'}, 'a&amp;b')
    assert_equal('a&b', f.name)
    assert_equal('a&b', f.value)
  end

  def test_radio_button
    f = Mechanize::Form::RadioButton.new(fake_node, nil)
    assert_equal('a&b', f.name)
    assert_equal('a&b', f.value)
  end

  def fake_node
    {
      'name'  => 'a&amp;b',
      'value' => 'a&amp;b'
    }
  end
end

Version data entries

3 entries across 3 versions & 3 rubygems

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