[rspec-users] Cucumber step FIT-like tables

Chris Flipse cflipse at gmail.com
Tue Oct 28 13:52:47 EDT 2008


On Mon, Oct 27, 2008 at 2:33 PM, aidy lewis <aidy.lewis at googlemail.com>wrote:

> Hi,
>
> I am having a problem with my Cucumber step FIT-like tables.
>
> This is my scenario
>
>  Scenario: Filter by new files added
>    Given a database update that creates an ExpiryDate that is within 30
> days
>    And a logged in OLC user
>    When clicks 'After Sales'
>    And selects 'New files added within 30 days' in the filter by drop down
>    Then verify the AE numbers of:
>    | text |
>    | ABHA338K |
>    | ABEB702B |
>    | ABBQ403P |
>    | ABBQ404J |
>
> My step implementation is:
>
> Then /verify the AE numbers of:/ do |link_table|
>      link_table.hashes.each do |hash|
>      browser.link(:url, Regexp.new(hash['text'])).exist?
>    end
>  end
>
> But I am getting this
>
> Then verify the AE numbers of:
>  expected 1 block argument(s), got 0 (Cucumber::ArityMismatchError)
>
>
The problem isn't with your table, it's with your step definition:  You're
telling cucumber to expect an argument, without telling it where to find
that argument.

Then /verify the AE numbers of: (\w+)/ do |link_table|
  # ....
end

and you'll need to adjust the scenario to provide a number:
Scenario: Filter by new files added
   Given a database update that creates an ExpiryDate that is within 30 days
   And a logged in OLC user
   When clicks 'After Sales'
   And selects 'New files added within 30 days' in the filter by drop down
   Then verify the AE numbers of: ABHA338K

    # then your table goes here.


-- 
// anything worth taking seriously is worth making fun of
// http://blog.devcaffeine.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20081028/31358a5d/attachment.html>


More information about the rspec-users mailing list