[rspec-users] webrat cannot find label?

Mike Sassak msassak at gmail.com
Thu Nov 13 14:20:59 EST 2008


Hi James,

If you're using the generated common_webrat steps that cucumber
generates for Rails projects, then "I select X from Y" should work
just fine. The step itself calls Webrat's select method like so:
selects(value, :from => field).

You can see an example of sorts in the first comments here:
http://www.benmabey.com/2008/02/04/rspec-plain-text-stories-webrat-chunky-bacon/

HTH,
Mike

On Thu, Nov 13, 2008 at 2:02 PM, James B. Byrne <byrnejb at harte-lyne.ca> wrote:
> Cucumber 0.1.9, Rails 2.2.0RC1, Ruby 1.8.6, Webrat... etc.
>
> Here is the scenario:
>
>  Scenario: Attempt to ADD a VALID entity
>    Given I am on the new entity page
>    When I fill in "Common Name" with "My Common Name"
>      And I <do what> to select "CORP" from the list labelled "Legal Form"
>      And I fill in "Full Legal Name" with "My Full Legal Name"e
>      And I press "Create"
>    Then I should see "was successfully created"
>
> What is the correct syntax to test selecting from a range of values
> present in an input box?  I have tried several variants of "select x from
> y" and I have tried to match the syntax of webrat to cucumber but nothing
> I do seems to work as I anticipate.  Do I have to write my own step for
> this sort of thing?  The "fill in" syntax seems to find a generated step,
> because I certainly have not written one for it.  I so,. should not all of
> the input methods do likewise?
>
> Guidance will be greatly appreciated.
>
>
> --
> ***          E-Mail is NOT a SECURE channel          ***
> James B. Byrne                mailto:ByrneJB at Harte-Lyne.ca
> 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
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>


More information about the rspec-users mailing list