Skip to content

Commit

Permalink
Merge pull request #87 from claudiob/allow-requests-with-only-extra-p…
Browse files Browse the repository at this point in the history
…arams

Allow requests with extra_params and no parameters
  • Loading branch information
oestrich committed Sep 2, 2013
2 parents 9a5c79e + acaaea6 commit eac8414
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
3 changes: 1 addition & 2 deletions lib/rspec_api_documentation/dsl/endpoint.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,7 @@ def query_string
end

def params
return unless example.metadata[:parameters]
parameters = example.metadata[:parameters].inject({}) do |hash, param|
parameters = example.metadata.fetch(:parameters, {}).inject({}) do |hash, param|
set_param(hash, param)
end
parameters.merge!(extra_params)
Expand Down
12 changes: 12 additions & 0 deletions spec/dsl_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,18 @@
end
end

context "request with only extra params" do
post "/orders" do
context "extra options for do_request" do
before do
client.should_receive(:post).with("/orders", {"order_type" => "big"}, nil)
end

example_request "should take an optional parameter hash", :order_type => "big"
end
end
end

context "last_response helpers" do
put "/orders" do
it "status" do
Expand Down

0 comments on commit eac8414

Please sign in to comment.