forked from zipmark/rspec_api_documentation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdisable_dsl.feature
50 lines (45 loc) · 1.54 KB
/
disable_dsl.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
Feature: Disable DSL features
Background:
Given a file named "app.rb" with:
"""
class App
def self.call(env)
request = Rack::Request.new(env)
response = Rack::Response.new
response["Content-Type"] = "text/plain"
response.write(request.params["status"])
response.write(request.params["method"])
response.finish
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
config.disable_dsl_status!
config.disable_dsl_method!
end
resource "Orders" do
get "/orders" do
parameter :status, "Order status to search for"
parameter :method, "Method of delivery to search for"
example "Viewing all orders" do
do_request :status => "pending"
expect(response_status).to eq(200)
expect(response_body).to eq("pending")
end
example "Checking the method" do
do_request :method => "ground"
expect(http_method).to eq(:get)
expect(response_body).to eq("ground")
end
end
end
"""
When I run `rspec app_spec.rb --require ./app.rb --format RspecApiDocumentation::ApiFormatter`
Scenario: Output should have the correct error line
Then the output should contain "2 examples, 0 failures"
And the exit status should be 0