[rspec-users] [Cucumber] How can I pass an XML block as a parameter?

Zach Dennis zach.dennis at gmail.com
Tue Apr 14 22:53:50 EDT 2009

On Tue, Apr 14, 2009 at 10:37 PM, Stephen Eley <sfeley at gmail.com> wrote:
> On Tue, Apr 14, 2009 at 8:37 PM, Ben Mabey <ben at benmabey.com> wrote:
>> Have you tried the pystring syntax?
>> Given I want to have multiple lines
>> """
>> I can pass them
>> in with three quotes...
>> """
> How does that parse into a step definition?  Would it be:
> Given /^I want to have multiple lines\n(.*)$/m do |text|

    Given /^I want to have multiple lines$/m do |text|

Cucumber parses it and appends it to the blocks argument list---so it
will always be the last argument. e.g.

    Given /^(\w+) want to have multiple lines$/m do |who, text|

It is a cucumber PyString object, but you can treat it like a normal string.

> ...or would it be something else?  Is the newline character necessary?
>  Are the quotes included?  And does this imply that multiline text
> must always be separated from from steps in lines of its own?
> Sorry if I'm asking dumb questions, but I was trying to look this up a
> few weeks ago myself to represent some example Markdown data, and
> eventually gave up.  This isn't documented anywhere that I could find.
>  I've also never heard of pystring syntax -- I just tried to Google
> that too, but all I got were references to Java libraries and no
> simple syntax reference.
> --
> Have Fun,
>   Steve Eley (sfeley at gmail.com)
>   ESCAPE POD - The Science Fiction Podcast Magazine
>   http://www.escapepod.org
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users

Zach Dennis

More information about the rspec-users mailing list