-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathspec_helper.rb
48 lines (39 loc) · 1.43 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
# frozen_string_literal: true
require 'simplecov'
SimpleCov.start
require 'bundler/setup'
require 'phobos_prometheus'
require './spec/support/collector_context.rb'
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!
# This config option will be enabled by default on RSpec 4,
# but for reasons of backwards compatibility, you have to
# set it on RSpec 3.
#
# It causes the host group and examples to inherit metadata
# from the shared context.
config.shared_context_metadata_behavior = :apply_to_host_groups
config.expect_with :rspec do |c|
c.syntax = :expect
end
config.around(:each, :with_logger) do |example|
Phobos.silence_log = true
Phobos.configure(Hash(logger: { stdout_json: true }))
example.run
end
config.after(:each, :clear_config) do
PhobosPrometheus.instance_variable_set(:@config, nil)
PhobosPrometheus.instance_variable_set(:@metrics, [])
end
config.around(:each, :configured) do |example|
Phobos.silence_log = true
Phobos.configure(Hash(logger: { stdout_json: true }))
PhobosPrometheus.configure('spec/fixtures/phobos_prometheus.yml')
example.run
PhobosPrometheus.instance_variable_set(:@config, nil)
PhobosPrometheus.instance_variable_set(:@metrics, [])
end
end