[rspec-users] Cucumber tables
aslak hellesoy
aslak.hellesoy at gmail.com
Fri May 15 13:56:58 EDT 2009
> I cannot seem to locate any documentation on how to implement the new
> table syntax otherwise I would not bother the list with this.
>
I'm not sure what you mean by "new" table syntax. The syntax for
tables hasn't really changed since it was introduced.
> I wish to write something like this:
>
> And we do have a forex rate for the following currency code and date
> |code | date | rate |
> |"USD"|"2009-04-01"|"0.8555"|
> |"USD"|"2009-04-05"|"0.8444"|
>
Why are you quoting the cell values?
> Then /^we do have a forex (.+) for the following currency (.+) and
> (.+)$/ \
> do |rate,code,date,table|
> # table is a Cucumber::Ast::Table
> puts rate
> puts code
> puts date
> end
>
> All I see from this is:
> ...
> rate
> code
> date
Which makes sense - these are the values of the 3 groups in your regexp.
> And we do have a forex rate for the following currency code and date
> #
> features/app/models/currency_exchange_rates/step_definitions/currency_exchange_rates_steps.rb:8
> | code | date | rate |
> | "USD" | "2009-04-01" | "0.8555" |
> | "USD" | "2009-04-05" | "0.8444" |
>
> I only get one iteration of output and that only displays the regex
> matches found in the original string.
>
> What is happening with the rest of the data? Is the table data keyed by
> the headings or is it position dependent on the matcher order? In other
> words, does the data in the table have to be in the same order as the
> regexp in the preceding clause. If so, then why the table headings?
Doc:
http://wiki.github.com/aslakhellesoy/cucumber/scenario-outlines
Please let us know what's missing or unclear about that.
Aslak
> --
> Posted via http://www.ruby-forum.com/.
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>
More information about the rspec-users
mailing list