Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for do_request and extra parameters containing path params and query string params #53

Merged
merged 2 commits into from
Sep 29, 2012
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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