blob: addb134c1afcdfa309e92f9cd49a910ea5e0d9f4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
require 'bundler'
begin
require 'simplecov'
SimpleCov.start do
add_filter '/test/'
add_filter '/vendor/' # for travis-ci
add_filter do |source_file|
source_file.lines.count < 15
end
# source: https://travis-ci.org/zenhob/hcl
minimum_coverage 80
end
rescue LoadError
$stderr.puts 'No test coverage tools found, skipping coverage check.'
end
# override the default hcl dir
ENV['HCL_DIR'] = File.dirname(__FILE__)+"/dot_hcl"
require 'hcl'
require 'minitest/autorun'
require 'mocha/setup'
require 'fileutils'
require 'faraday'
require 'byebug' if ENV['DEBUG']
# require test extensions/helpers
Dir[File.dirname(__FILE__) + '/ext/*.rb'].each { |ext| require ext }
class HCl::TestCase < MiniTest::Test
attr_reader :http
def setup
@stubs = Faraday::Adapter::Test::Stubs.new
@http = HCl::Net.new \
'login' => 'bob',
'password' => 'secret',
'subdomain' => 'bobclock',
'test_adapter' => @stubs
end
def register_uri method, path, data={}
@stubs.send(method, path) { [200, {}, Yajl::Encoder.encode(data)] }
end
def teardown
@stubs.verify_stubbed_calls
end
end
|