File tree Expand file tree Collapse file tree 3 files changed +13
-15
lines changed Expand file tree Collapse file tree 3 files changed +13
-15
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ Feature: Document callbacks
1212 request = Net::HTTP::Post.new(uri.path)
1313 request.body = '{"message":"Something interesting happened!"}'
1414 request.add_field("Content-Type", "application/json")
15+ request.add_field("User-Agent", "InterestingThingApp")
1516 http.request request
1617 end
1718 200
@@ -65,11 +66,9 @@ Feature: Document callbacks
6566 And I navigate to "Receiving a callback when interesting things happen"
6667 Then I should see the route is "POST /callback"
6768 And I should see the following request headers:
68- """
69- Content-Type: application/json
70- Accept: */*
71- User-Agent: Ruby
72- """
69+ | Content -Type | application /json |
70+ | Accept | */* |
71+ | User -Agent | InterestingThingApp |
7372 And I should see the following request body:
7473 """
7574 {
Original file line number Diff line number Diff line change @@ -71,10 +71,8 @@ Feature: Generate HTML documentation from test examples
7171 And I navigate to "Greeting your favorite gem"
7272 Then I should see the route is "GET /greetings?target=rspec_api_documentation"
7373 And I should see the following request headers:
74- """
75- Host: example.org
76- Cookie:
77- """
74+ | Host | example .org |
75+ | Cookie | |
7876 And I should see the following query parameters:
7977 """
8078 target: rspec_api_documentation
@@ -85,10 +83,8 @@ Feature: Generate HTML documentation from test examples
8583 And I navigate to "Greeting your favorite gem"
8684 Then I should see the response status is "200 OK"
8785 And I should see the following response headers:
88- """
89- Content-Type: application/json
90- Content-Length: 35
91- """
86+ | Content -Type | application /json |
87+ | Content -Length | 35 |
9288 And I should see the following response body:
9389 """
9490 {
Original file line number Diff line number Diff line change 1616 names . zip ( descriptions ) . should == table . rows
1717end
1818
19- Then /^I should see the following (request|response) headers:$/ do |part , headers |
20- page . should have_css ( "pre.#{ part } .headers" , :text => headers )
19+ Then /^I should see the following (request|response) headers:$/ do |part , table |
20+ text = page . find ( "pre.#{ part } .headers" ) . text
21+ actual_headers = text . split ( "\n " )
22+ expected_headers = table . raw . map { |row | row . join ( ": " ) }
23+ actual_headers . should =~ expected_headers
2124end
2225
2326Then /^I should see the route is "([^"]*)"$/ do |route |
You can’t perform that action at this time.
0 commit comments