[rspec-users] [Cucumber] How can I pass an XML block as a parameter?
lists at ruby-forum.com
Tue Apr 14 19:39:26 EDT 2009
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
"<?xml version="1.0" encoding="UTF-8"?>
<text>Fake Catalan Source</text>
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.
We've found this reference:
It's marked as resolved, but we can't seem to get it to work with the
The parser statement is:
When /^I send a (GET|POST|PUT|DELETE) to ([\/\w]+)(?: with parameters:
)?(.*) and post body (.*)$/m do |method, path, params, body|
send(method.downcase.to_sym, path, params)
$ cucumber features/phrases_xml.feature -n
`parse_or_fail': features/phrases_xml.feature:9:6: Parse error, expected
one of "|", "\n", "\r", "\"\"\"", "#", "Given", "When", "Then", "And",
"But", "@", "Scenario", "Scenario Outline".
from /usr/bin/cucumber:19:in `load'
Posted via http://www.ruby-forum.com/.
More information about the rspec-users