summaryrefslogtreecommitdiffstats
path: root/test/test_helper.rb
diff options
context:
space:
mode:
authorZack Hobson2014-04-21 12:56:40 -0700
committerZack Hobson2014-04-21 13:06:14 -0700
commit3bc51e96c7a88dfdf8d003c669d4af33d92ab90c (patch)
tree8f996ddf2773482e3d0cddcbabcb77ab15819009 /test/test_helper.rb
parent92974b1fa9d8a975a8583eba967a346de1e20781 (diff)
downloadhcl-3bc51e96c7a88dfdf8d003c669d4af33d92ab90c.tar.bz2
remove dependency on fakeweb and net::http
By using pure faraday for the test and error handling code, the way is cleared for dropping in alternative http clients.
Diffstat (limited to 'test/test_helper.rb')
-rw-r--r--test/test_helper.rb12
1 files changed, 6 insertions, 6 deletions
diff --git a/test/test_helper.rb b/test/test_helper.rb
index 95cb0b4..4d1c3a5 100644
--- a/test/test_helper.rb
+++ b/test/test_helper.rb
@@ -22,7 +22,7 @@ require 'hcl'
require 'minitest/autorun'
require 'mocha/setup'
require 'fileutils'
-require 'fakeweb'
+require 'faraday'
require 'debugger' if ENV['DEBUG']
# require test extensions/helpers
@@ -31,20 +31,20 @@ Dir[File.dirname(__FILE__) + '/ext/*.rb'].each { |ext| require ext }
class HCl::TestCase < MiniTest::Test
attr_reader :http
def setup
- FakeWeb.allow_net_connect = false
+ @stubs = Faraday::Adapter::Test::Stubs.new
@http = HCl::Net.new \
'login' => 'bob',
'password' => 'secret',
- 'subdomain' => 'bobclock'
+ 'subdomain' => 'bobclock',
+ 'test_adapter' => @stubs
end
def register_uri method, path, data={}
- FakeWeb.register_uri(method, "https://bob:secret@bobclock.harvestapp.com#{path}",
- body: Yajl::Encoder.encode(data))
+ @stubs.send(method, path) { [200, {}, Yajl::Encoder.encode(data)] }
end
def teardown
- FakeWeb.clean_registry
+ @stubs.verify_stubbed_calls
end
end