-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathspec_helper.rb
More file actions
60 lines (45 loc) · 1.49 KB
/
spec_helper.rb
File metadata and controls
60 lines (45 loc) · 1.49 KB
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
52
53
54
55
56
57
58
59
60
# frozen_string_literal: true
# rspec adds lib to $LOAD_PATH, remove it to catch bad requires
# from https://github.com/rspec/rspec-core/issues/1983#issuecomment-108748690
$LOAD_PATH.delete_if { |p| File.expand_path(p) == File.expand_path("./lib") }
require "json"
require "rspec"
require "toxiproxy"
require "vcr"
require "webmock/rspec"
require_relative "../lib/twingly/http"
require_relative "spec_help/env_helper"
require_relative "spec_help/fixture"
require_relative "spec_help/http_helpers"
require_relative "spec_help/test_logger"
require_relative "spec_help/toxiproxy_config"
require_relative "spec_help/port_prober"
# Start with a clean slate, destroy all proxies if any
Toxiproxy.all.destroy
Toxiproxy.populate(ToxiproxyConfig.proxies)
VCR.configure do |conf|
conf.cassette_library_dir = "spec/fixtures/vcr_cassettes"
conf.hook_into :webmock
conf.configure_rspec_metadata!
conf.ignore_request do |request|
request.uri.start_with?("http://127.0.0.1:8474/") # toxiproxy-server
end
end
RSpec.configure do |conf|
conf.include EnvHelper
conf.include HttpHelpers
conf.after(:suite) do
Toxiproxy.all.destroy # Be nice, end with a clean slate
end
conf.expect_with(:rspec) do |expectations|
expectations.max_formatted_output_length = nil
end
conf.mock_with(:rspec) do |mocks|
mocks.verify_doubled_constant_names = true
end
conf.disable_monkey_patching!
conf.filter_run_when_matching :focus
conf.warnings = true
conf.order = :random
Kernel.srand conf.seed
end