Permalink
Browse files

fix cucumber steps for csv array response

  • Loading branch information...
1 parent 2ce1c34 commit 21f76d76e56eb780656d7eaf8c6e15099ccc6aaa @davidgg davidgg committed Feb 8, 2014
@@ -16,15 +16,18 @@ Feature: Handles Multiple Formats
Scenario: A CSV service
Given a remote service that returns:
- """
- "Last Name","Name"
- "jennings","waylon"
- "cash","johnny"
- """
+ """
+ "Last Name","Name"
+ "jennings","waylon"
+ "cash","johnny"
+ """
And that service is accessed at the path '/service.csv'
And the response from the service has a Content-Type of 'application/csv'
When I call HTTParty#get with '/service.csv'
- Then it should return a multidimensional array equaling: '[["Last Name","Name"],["jennings","waylon"],["cash","johnny"]]'
+ Then it should return an Array equaling:
+ | Last Name | Name |
+ | jennings | waylon |
+ | cash | johnny |
Scenario: A JSON service
Given a remote service that returns '{ "jennings": "waylon", "cash": "johnny" }'
@@ -29,6 +29,11 @@ def constantize(camel_cased_word)
end
end
+Then /it should return an Array equaling:/ do |array|
+ @response_from_httparty.should be_an_instance_of(Array)
+ @response_from_httparty.should eql array.raw
+end
+
Then /it should return a response with a (\d+) response code/ do |code|
@response_from_httparty.code.should eql(code.to_i)
end
@@ -3,6 +3,11 @@
Given "the response from the service has a body of '#{response_body}'"
end
+Given /^a remote service that returns:$/ do |response_body|
+ @handler = BasicMongrelHandler.new
+ @handler.response_body = response_body
+end
+
Given /a remote service that returns a (\d+) status code/ do |code|
@handler = BasicMongrelHandler.new
@handler.response_code = code

0 comments on commit 21f76d7

Please sign in to comment.