forked from zipmark/rspec_api_documentation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathheaders.feature
39 lines (34 loc) · 1000 Bytes
/
headers.feature
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
Feature: Specifying request headers
Background:
Given a file named "app.rb" with:
"""
class App
def self.call(env)
if env["HTTP_ACCEPT"] == "foo"
[200, {}, ["foo"]]
else
[406, {}, ["unknown content type"]]
end
end
end
"""
And a file named "app_spec.rb" with:
"""
require "rspec_api_documentation"
require "rspec_api_documentation/dsl"
RspecApiDocumentation.configure do |config|
config.app = App
end
resource "FooBars" do
get "/foobar" do
header "Accept", "foo"
example "Getting Foo" do
do_request
expect(response_body).to eq("foo")
end
end
end
"""
When I run `rspec app_spec.rb --require ./app.rb --format RspecApiDocumentation::ApiFormatter`
Scenario: Sending headers along with the request
Then the output should not contain "unknown content type"