Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 58 lines (51 sloc) 2.379 kb
2febfe3 @dpetersen Cucumber features and steps for most functionality as of the 0.2.8
dpetersen authored
1 Feature: Handles Multiple Formats
2
3 As a developer
4 I want to be able to consume remote services of many different formats
5 And I want those formats to be automatically detected and handled
6 Because web services take many forms
7 And I don't want to have to do any extra work
8
9 Scenario: An HTML service
10 Given a remote service that returns '<h1>Some HTML</h1>'
d018df2 @sandro Cucumber suite sends unique requests
sandro authored
11 And that service is accessed at the path '/html_service.html'
2febfe3 @dpetersen Cucumber features and steps for most functionality as of the 0.2.8
dpetersen authored
12 And the response from the service has a Content-Type of 'text/html'
d018df2 @sandro Cucumber suite sends unique requests
sandro authored
13 When I call HTTParty#get with '/html_service.html'
2febfe3 @dpetersen Cucumber features and steps for most functionality as of the 0.2.8
dpetersen authored
14 Then it should return a String
15 And the return value should match '<h1>Some HTML</h1>'
16
4ac7d97 @davidgg added CSV support
davidgg authored
17 Scenario: A CSV service
f9752b6 @davidgg fix for travis lexic
davidgg authored
18 Given a remote service that returns:
21f76d7 @davidgg fix cucumber steps for csv array response
davidgg authored
19 """
20 "Last Name","Name"
21 "jennings","waylon"
22 "cash","johnny"
23 """
4ac7d97 @davidgg added CSV support
davidgg authored
24 And that service is accessed at the path '/service.csv'
25 And the response from the service has a Content-Type of 'application/csv'
26 When I call HTTParty#get with '/service.csv'
21f76d7 @davidgg fix cucumber steps for csv array response
davidgg authored
27 Then it should return an Array equaling:
28 | Last Name | Name |
29 | jennings | waylon |
30 | cash | johnny |
4ac7d97 @davidgg added CSV support
davidgg authored
31
2febfe3 @dpetersen Cucumber features and steps for most functionality as of the 0.2.8
dpetersen authored
32 Scenario: A JSON service
33 Given a remote service that returns '{ "jennings": "waylon", "cash": "johnny" }'
34 And that service is accessed at the path '/service.json'
35 And the response from the service has a Content-Type of 'application/json'
36 When I call HTTParty#get with '/service.json'
37 Then it should return a Hash equaling:
38 | key | value |
39 | jennings | waylon |
40 | cash | johnny |
41
42 Scenario: An XML Service
43 Given a remote service that returns '<singer>waylon jennings</singer>'
44 And that service is accessed at the path '/service.xml'
45 And the response from the service has a Content-Type of 'text/xml'
46 When I call HTTParty#get with '/service.xml'
47 Then it should return a Hash equaling:
48 | key | value |
49 | singer | waylon jennings |
b7d4e21 @jasonroelofs Don't try to parse javascript as JSON
jasonroelofs authored
50
51 Scenario: A Javascript remote file
52 Given a remote service that returns '$(function() { alert("hi"); });'
53 And that service is accessed at the path '/service.js'
54 And the response from the service has a Content-Type of 'application/javascript'
55 When I call HTTParty#get with '/service.js'
56 Then it should return a String
57 And the return value should match '$(function() { alert("hi"); });'
Something went wrong with that request. Please try again.