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

Ben Mabey ben at benmabey.com
Tue Apr 14 20:37:14 EDT 2009


On Apr 14, 2009, at 5:39 PM, Wolfram Arnold wrote:

> We're trying to verify XML REST API's and would like to write Cucumber
> specs of the following type:
>
>  Scenario: Create a phrase
>    Given I have an authenticated session for user with login "steve"
>    When I send a POST to /phrases with parameters: locale=ca and post
> body
>      "<?xml version="1.0" encoding="UTF-8"?>
>        <phrase>
>            <uuid>060e985b-0307-4c8f-b43f-c16f0e45196d</uuid>
>            <text>Fake Catalan Source</text>
>            <source_language>ca</source_language>
>        </phrase>"
>    Then I get a 201 (created) status result
>    And I a phrase object with UUID=060e985b-0307-4c8f-b43f- 
> c16f0e45196d
> exists on the server
>
> In other words, we're trying to pass a multi-line value to the parser.

Have you tried the pystring syntax?

Given I want to have multiple lines
"""
I can pass them
in with three quotes...
"""


-Ben


More information about the rspec-users mailing list