diff --git a/lib/rspec_api_documentation/dsl/endpoint.rb b/lib/rspec_api_documentation/dsl/endpoint.rb index 6373b633..222392c7 100644 --- a/lib/rspec_api_documentation/dsl/endpoint.rb +++ b/lib/rspec_api_documentation/dsl/endpoint.rb @@ -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) diff --git a/spec/dsl_spec.rb b/spec/dsl_spec.rb index 5902665e..207e9d6f 100644 --- a/spec/dsl_spec.rb +++ b/spec/dsl_spec.rb @@ -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