forked from zipmark/rspec_api_documentation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexample_request.feature
59 lines (52 loc) · 1.57 KB
/
example_request.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
Feature: Example Request
Background:
Given a file named "app.rb" with:
"""
class App
def self.call(env)
[200, {}, ["Hello, world"]]
end
end
"""
Scenario: Output should have the correct error line
Given 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 "Example Request" do
get "/" do
example_request "Greeting your favorite gem" do
expect(status).to eq(201)
end
end
end
"""
When I run `rspec app_spec.rb --require ./app.rb --format RspecApiDocumentation::ApiFormatter`
Then the output should contain "expected: 201"
Then the output should not contain "endpoint.rb"
Then the output should contain:
"""
rspec ./app_spec.rb:10 # Example Request GET / Greeting your favorite gem
"""
Scenario: should work with RSpec monkey patching disabled
When a file named "app_spec.rb" with:
"""
require "rspec_api_documentation/dsl"
RSpec.configure do |config|
config.disable_monkey_patching!
end
RspecApiDocumentation.configure do |config|
config.app = App
end
RSpec.resource "Example Request" do
get "/" do
example_request "Greeting your favorite gem" do
expect(status).to eq(200)
end
end
end
"""
Then I successfully run `rspec app_spec.rb --require ./app.rb`