public
Fork of brynary/webrat
Description: Webrat - Ruby Acceptance Testing for Web applicationz
Homepage: http://www.brynary.com/uploads/webrat/rdoc/index.html
Clone URL: git://github.com/joevandyk/webrat.git
Search Repo:
Fix bug with empty select list
joevandyk (author)
Sun Apr 13 16:02:35 -0700 2008
commit  f9ff509f0243fe2cf7773ceed7b70579ed2b4c12
tree    7fc56ecc43336f76cc5b6a5ba38593266c38d8c4
parent  275611a0a3a0470391c0701bc909cf4c8e921e9d
...
237
238
239
 
240
241
242
...
237
238
239
240
241
242
243
0
@@ -237,6 +237,7 @@
0
       selected_options = @element / "option[@selected='selected']"
0
       selected_options = @element / "option:first" if selected_options.empty?
0
       selected_options.map do |option|
0
+ return "" if option.nil?
0
         option["value"] || option.innerHTML
0
       end
0
     end
...
56
57
58
 
 
 
 
 
 
 
 
 
 
 
59
60
61
...
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
0
@@ -56,6 +56,17 @@
0
     @session.selects "January", :from => "month"
0
     @session.clicks_button
0
   end
0
+
0
+ def test_should_work_with_empty_select_lists
0
+ @response.stubs(:body).returns(<<-EOS)
0
+ <form method="post" action="/login">
0
+ <select name="month"></select>
0
+ <input type="submit" />
0
+ </form>
0
+ EOS
0
+ @session.expects(:post_via_redirect).with("/login", 'month' => '')
0
+ @session.clicks_button
0
+ end
0
   
0
   def test_should_work_without_specifying_the_field_name_or_label
0
     @response.stubs(:body).returns(<<-EOS)

Comments

    No one has commented yet.