-
Notifications
You must be signed in to change notification settings - Fork 30
/
spec_helper.rb
48 lines (39 loc) · 1.41 KB
/
spec_helper.rb
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
if ENV["COVERAGE"]
require "simplecov"
SimpleCov.start do
track_files "{lib}/**/*.rb"
add_filter "/spec/"
end
if ENV["CODECOV_TOKEN"]
require "codecov"
SimpleCov.formatter = SimpleCov::Formatter::Codecov
end
end
require "bundler/setup"
require 'dotenv/load'
require "harvesting"
require "webmock"
require "webmock/rspec"
require "vcr"
VCR.configure do |config|
config.cassette_library_dir = "fixtures/vcr_cassettes"
config.hook_into :webmock # or :fakeweb
config.filter_sensitive_data('$HARVEST_ACCESS_TOKEN') { ENV['HARVEST_ACCESS_TOKEN'] }
config.filter_sensitive_data('$HARVEST_NON_ADMIN_ACCESS_TOKEN') { ENV['HARVEST_NON_ADMIN_ACCESS_TOKEN'] }
config.filter_sensitive_data('$HARVEST_ACCOUNT_ID') { ENV['HARVEST_ACCOUNT_ID'] }
config.filter_sensitive_data('$HARVEST_NON_ADMIN_ACCOUNT_ID') { ENV['HARVEST_NON_ADMIN_ACCOUNT_ID'] }
end
RSpec.configure do |config|
# Enable flags like --only-failures and --next-failure
config.example_status_persistence_file_path = ".rspec_status"
# Disable RSpec exposing methods globally on `Module` and `main`
config.disable_monkey_patching!
config.expect_with :rspec do |c|
c.syntax = :expect
end
config.around(:each, :vcr) do |example|
name = example.metadata[:full_description].split(/\s+/, 2).join("/").gsub(/[^\w\/]+/, "_")
VCR.use_cassette(name) { example.call }
end
end
require_relative './harvesting/harvest_data_setup'