Skip to content

Commit

Permalink
eager-load HTTPClient so it can be used in specs
Browse files Browse the repository at this point in the history
  • Loading branch information
rubiii committed Jan 5, 2013
1 parent b129b1e commit 385129b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
11 changes: 6 additions & 5 deletions spec/savon/options_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,18 +60,19 @@
non_routable_ip = "http://10.255.255.1"
client = new_client(:endpoint => non_routable_ip, :open_timeout => 1)

# TODO: make HTTPI tag timeout errors, then depend on HTTPI::TimeoutError instead of a specific client error [dh, 2012-12-08]
# TODO: this spec fails when run in isolation "uninitialized constant HTTPClient" [dh, 2012-12-31]
expect { client.call(:authenticate) }.to raise_error(HTTPClient::ConnectTimeoutError)
# TODO: make HTTPI tag timeout errors, then depend on HTTPI::TimeoutError
# instead of a specific client error [dh, 2012-12-08]
expect { client.call(:authenticate) }.
to raise_error(HTTPClient::ConnectTimeoutError)
end
end

context "global :read_timeout" do
it "makes the client timeout after n seconds" do
client = new_client(:endpoint => @server.url(:timeout), :open_timeout => 1, :read_timeout => 1)

# TODO: this spec fails when run in isolation "uninitialized constant HTTPClient" [dh, 2012-12-31]
expect { client.call(:authenticate) }.to raise_error(HTTPClient::ReceiveTimeoutError)
expect { client.call(:authenticate) }.
to raise_error(HTTPClient::ReceiveTimeoutError)
end
end

Expand Down
4 changes: 4 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,9 @@

HTTPI.log = false

# don't have HTTPI lazy-load HTTPClient, because then
# it can't actually be refered to inside the specs.
require "httpclient"

require "support/endpoint"
require "support/fixture"

0 comments on commit 385129b

Please sign in to comment.