Skip to content

Commit

Permalink
Make sure base options can be overridden
Browse files Browse the repository at this point in the history
  • Loading branch information
jacegu committed Apr 21, 2016
1 parent 5114059 commit f96ed1a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/dnsimple/client.rb
Expand Up @@ -172,7 +172,7 @@ def request_options(custom_options = {})
options = base_options
Extra.deep_merge!(options, auth_options)
Extra.deep_merge!(options, proxy_options)
Extra.deep_merge!(custom_options, options)
Extra.deep_merge!(options, custom_options)
end

def base_options
Expand Down
13 changes: 13 additions & 0 deletions spec/dnsimple/client_spec.rb
Expand Up @@ -178,6 +178,19 @@
subject = described_class.new(proxy: "example-proxy.com:4321")
subject.request(:get, "test", nil, {})
end

it "default options can be overriden" do
expect(HTTParty).to receive(:get).
with(
"#{subject.base_url}test",
format: :json,
headers: { "Accept" => "application/json", "User-Agent" => "dnsimple-custom-integration" }
).
and_return(double("response", code: 200))

subject = described_class.new
subject.request(:get, "test", nil, headers: { "User-Agent" => "dnsimple-custom-integration" })
end
end

end

0 comments on commit f96ed1a

Please sign in to comment.