[rspec-users] Cucumber Scenario syntax

aslak hellesoy aslak.hellesoy at gmail.com
Sat Feb 27 04:30:57 EST 2010


On Sat, Feb 27, 2010 at 5:17 AM, Ed Howland <ed.howland at gmail.com> wrote:

> Hi,
>
> Searched for this everywhere, so here goes.
>
> I am having trouble matching multiline strings with leading whitespace
> in them using the """ operator.
>
>
Cucumber intentionally removes all the space characters left of the leftmost
triple quote.
Just indent everything relative to the leftmost triple quote and you'll be
ok.

Aslak



> E.g.
>    Then the output should be
>    """
> Usage:
>  mygem [options] destination
>  Template Options:
>     -r, --ruby                     install the ruby template
>     --ruby-19                      install the ruby-19 template
>  General options:
>     -f, --force                    force overwriting files, don't ask
>     -s, --skip                     skip file if it exists
>     -q, --quiet                    runs quietly, no output
>     -V, --verbose                  Show lots of output
>     -v, --version                  Show this version
>     -p, --pretend                  dry run, show what would have happened
>     -x, --debug                    Show debugging output
>     -h, --help                     Show this help
> """
>
> I am generating this (almost) t am I doing wrongexact output with 5
> leading space before the options, but the expected string is
> collapsing them down to one leading space:
>       Diff:
>
>
>      @@ -1,15 +1,14 @@
>      +Ok
>      +
>       Usage:
>       mygem [options] destination
>      -Template Options:
>      - -r, --ruby                     install the ruby template
>      - --ruby-19                      install the ruby-19 template
>       General options:
>      - -f, --force                    force overwriting files, don't ask
>      - -s, --skip                     skip file if it exists
>      - -q, --quiet                    runs quietly, no output
>      - -V, --verbose                  Show lots of output
>      - -v, --version                  Show this version
>      - -p, --pretend                  dry run, show what would have
> happened
>      - -x, --debug                    Show debugging output
>      - -h, --help                     Show this help
>      +     -f, --force                    force overwriting files, don't
> ask
>      +     -s, --skip                     skip file if it exists
>      +     -q, --quiet                    runs quietly, no output
>      +     -V, --verbose                  Show lots of output
>      +     -v, --version                  Show this version
>      +     -p, --pretend                  dry run, show what would
> have happened
>      +     -x, --debug                    Show debugging output
>      +     -h, --help                     Show this help
>
>
> What am I doing wrong?
>
> Thanks
>
> Cheers,
> Ed
>
> Ed Howland
> http://greenprogrammer.wordpress.com
> http://twitter.com/ed_howland
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20100227/8e95573e/attachment-0001.html>


More information about the rspec-users mailing list