Skip to content

Commit

Permalink
Add missing spec for proxy options
Browse files Browse the repository at this point in the history
  • Loading branch information
jacegu committed Apr 20, 2016
1 parent a5a1f7a commit d63ec2b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/dnsimple/client.rb
Expand Up @@ -192,7 +192,7 @@ def proxy_options

if proxy
address, port = proxy.split(":")
{ http_proxyaddr: address, http_proxyport: port }
options = { http_proxyaddr: address, http_proxyport: port }
end

options
Expand Down
16 changes: 15 additions & 1 deletion spec/dnsimple/client_spec.rb
Expand Up @@ -59,7 +59,6 @@
subject.execute(:get, "test", nil, authenticate: false)
}.not_to raise_error
end

end

describe "#get" do
Expand Down Expand Up @@ -180,6 +179,21 @@

subject.request(:post, 'foo', { something: "else" }, { headers: { "Content-Type" => "application/x-www-form-urlencoded" } })
end

it "includes options for proxy support" do
expect(HTTParty).to receive(:get).
with(
"#{subject.base_url}test",
format: :json,
http_proxyaddr: "example-proxy.com",
http_proxyport: "4321",
headers: { 'Accept' => 'application/json', 'User-Agent' => "dnsimple-ruby/#{Dnsimple::VERSION}" }
).
and_return(double('response', code: 200))

subject = described_class.new(proxy: "example-proxy.com:4321")
subject.request(:get, "test", nil, authenticate: false)
end
end

end

0 comments on commit d63ec2b

Please sign in to comment.