forked from WhitewidowScanner/whitewidow
-
Notifications
You must be signed in to change notification settings - Fork 0
/
spec_helper.rb
34 lines (29 loc) · 855 Bytes
/
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
require 'rspec'
require 'fileutils'
require_relative '../lib/imports/constants_and_requires'
require 'webmock/rspec'
require'vcr'
WebMock.disable_net_connect!
VCR.configure do |config|
config.cassette_library_dir = "spec/fixtures/vcr_cassettes"
config.hook_into :webmock
end
RSpec.configure do |config|
config.after(:each) do
# TODO: Remove dependency on tmp directory's existence so we can just FileUtils.rm_rf('tmp')
File.truncate(SITES_TO_CHECK_PATH, 0)
File.truncate('tmp/#sites.txt', 0)
end
### Silence stdout during tests ###
original_stderr = $stderr
original_stdout = $stdout
config.before(:all) do
# Redirect stderr and stdout
$stderr = File.open(File::NULL, "w")
$stdout = File.open(File::NULL, "w")
end
config.after(:all) do
$stderr = original_stderr
$stdout = original_stdout
end
end