test/test_multi_select.rb in mechanize-1.0.1.beta.20110107104205 vs test/test_multi_select.rb in mechanize-2.0.pre.1
- old
+ new
@@ -1,9 +1,21 @@
require "helper"
class MultiSelectTest < Test::Unit::TestCase
def setup
@agent = Mechanize.new
+ @page = @agent.get("http://localhost/form_multi_select.html")
+ @form = @page.forms.first
+ end
+
+ def test_option_with
+ o = @form.field_with(:name => 'list').option_with(:value => '1')
+ assert_equal '1', o.value
+ end
+
+ def test_options_with
+ os = @form.field_with(:name => 'list').options_with(:value => /1|2/)
+ assert_equal ['1', '2'].sort, os.map { |x| x.value }.sort
end
def test_select_none
page = @agent.get("http://localhost/form_multi_select.html")
form = page.forms.first