blob: 95cb0b40d5dc0586e6e46767ec74f44d21ce3322 (
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 => e
$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 'fakeweb'
require 'debugger' 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
FakeWeb.allow_net_connect = false
@http = HCl::Net.new \
'login' => 'bob',
'password' => 'secret',
'subdomain' => 'bobclock'
end
def register_uri method, path, data={}
FakeWeb.register_uri(method, "https://bob:secret@bobclock.harvestapp.com#{path}",
body: Yajl::Encoder.encode(data))
end
def teardown
FakeWeb.clean_registry
end
end
|