[rspec-users] Newbie's question about generated features by cucumber in Rails

aslak hellesoy aslak.hellesoy at gmail.com
Sat Oct 4 12:45:55 EDT 2008


On Sat, Oct 4, 2008 at 6:22 PM, Lian Liming <lianliming at gmail.com> wrote:
> Hi all,
>
> I am new to rspec and trying to use cucumber to learn writingfeatures.
> I follow the wiki page
> http://github.com/aslakhellesoy/cucumber/wikis/ruby-on-rails to start
> my first feature.
>
> The command "ruby script/generate feature Frooble name color
> description" generates a file "manage_froobles.feature" with
> itscontent as following:
>
> ------ manage_froobles.feature ---
> Feature: Manage froobles
>  In order to keep track of froobles
>  A frooble mechanic
>  Should be able to manage several froobles
>
>  Scenario: Register new frooble
>   <....omit some lines here...>
>
>  Scenario: Delete frooble
>   Given there are 4 froobles
>   When I delete the first frooble
>   Then there should be 3 froobles left
>
>   | initial | after |
>   | 100    | 99    |
>   | 1       | 0     |
> ------end of  manage_froobles.feature ---
>
> I quite understand most of lines in this file except the last few
> lines, which composes a two-column table with heads "initial" and
> "after". I am really confusing on what is the meaning of those data. I
> have studied some background knowledge about stories in BDD, while
> those don't help me understand this. So any hints?  Thanks in dvance!
>

This table will run the previous scenario once for each row in the
table, substituting the parameters in the scenario. The first line in
the table is just for documentation. It's inspired from column
fixtures in the FIT tool: http://fit.c2.com/wiki.cgi?ColumnFixture

Aslak

> Liming
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>


More information about the rspec-users mailing list