diff --git a/lib/rspec_api_documentation/dsl/endpoint.rb b/lib/rspec_api_documentation/dsl/endpoint.rb index a0a26c0b..2fd14a2c 100644 --- a/lib/rspec_api_documentation/dsl/endpoint.rb +++ b/lib/rspec_api_documentation/dsl/endpoint.rb @@ -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 diff --git a/spec/dsl_spec.rb b/spec/dsl_spec.rb index fa69e314..e736246f 100644 --- a/spec/dsl_spec.rb +++ b/spec/dsl_spec.rb @@ -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) }