Skip to content

Commit

Permalink
Merge pull request #53 from denyago/master
Browse files Browse the repository at this point in the history
Fix for do_request and extra parameters containing path params and query string params
  • Loading branch information
samwgoldman committed Sep 29, 2012
2 parents 38071c8 + 967cd60 commit 5293fe9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/rspec_api_documentation/dsl/endpoint.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def do_request(extra_params = {})
path_or_query = path

if method == :get && !query_string.blank?
path_or_query = path + "?#{query_string}"
path_or_query += "?#{query_string}"
else
params_or_body = respond_to?(:raw_post) ? raw_post : params
end
Expand Down
11 changes: 11 additions & 0 deletions spec/dsl_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,17 @@
end
end

get "/orders/:order_id/line_items/:id" do
parameter :type, "The type document you want"

describe "do_request" do
it "should correctly set path variables and other parameters" do
client.should_receive(method).with("/orders/3/line_items/2?type=short", nil, nil)
do_request(:id => 2, :order_id => 3, :type => 'short')
end
end
end

get "/orders/:order_id" do
let(:order) { stub(:id => 1) }

Expand Down

0 comments on commit 5293fe9

Please sign in to comment.