On Thu, Nov 13, 2008 at 7:41 PM, James B. Byrne <[EMAIL PROTECTED]>wrote:
>
> On Thu, November 13, 2008 14:02, James B. Byrne wrote:
>
> >
> > What is the correct syntax to test selecting from a range of values
> > present in an input box? ...
>
> The webrat API specifies this:
>
> selects(option_text, options = {})
>
> Verifies that a an option element exists on the current page with the
> specified text. You can optionally restrict the search to a specific
> select list by assigning options[:from] the value of the select list's
> name or a label. Stores the option's value to be sent when the form is
> submitted.
>
The API says to use the option text, not the value.
>
> But when I try to use something like:
>
> And I select "CORP" from "Legal Form"
> # features/step_definitions/webrat_steps.rb:16
>
CORP is the value of the option, the text is "CORP - Corporation"
Does this work?
Barry
>
> This is what happens:
>
> You have a nil object when you didn't expect it!
> The error occurred while evaluating nil.choose (NoMethodError)
>
> /usr/lib/ruby/gems/1.8/gems/webrat-0.3.2/lib/webrat/core/scope.rb:91:in
> `selects'
> /usr/lib/ruby/gems/1.8/gems/webrat-0.3.2/lib/webrat/rails.rb:88:in
> `send'
>
>
> So, checking out webrat.steps I see this:
>
> When /^I select "(.*)" from "(.*)"$/ do |value, field|
> selects(value, :from => field)
> end
>
> So, as far as I can make out, given the webrat API specifies that a label
> is an acceptable target, this should work. But it evidently does not. Is
> this a webrat problem then?
>
>
> --
> *** E-Mail is NOT a SECURE channel ***
> James B. Byrne mailto:[EMAIL PROTECTED]
> Harte & Lyne Limited http://www.harte-lyne.ca
> 9 Brockley Drive vox: +1 905 561 1241
> Hamilton, Ontario fax: +1 905 561 0757
> Canada L8E 3C3
>
> _______________________________________________
> rspec-users mailing list
> [email protected]
> http://rubyforge.org/mailman/listinfo/rspec-users
>
_______________________________________________
rspec-users mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/rspec-users