/
spec_helper.rb
54 lines (41 loc) · 1.39 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
49
50
51
52
53
54
require 'rubygems'
require 'guard'
require 'guard/ui'
require 'guard/guard'
require 'rspec'
ENV["GUARD_ENV"] = 'test'
Dir["#{File.expand_path('..', __FILE__)}/support/**/*.rb"].each { |f| require f }
puts "Please do not update/create files while tests are running."
RSpec.configure do |config|
config.color_enabled = true
config.order = :random
config.filter_run :focus => true
config.treat_symbols_as_metadata_keys_with_true_values = true
config.run_all_when_everything_filtered = true
config.before(:each) do
@fixture_path = Pathname.new(File.expand_path('../fixtures/', __FILE__))
# Ensure debug command execution isn't used in the specs
Guard.stub(:debug_command_execution)
# Stub all UI methods, so no visible output appears for the UI class
::Guard::UI.stub(:info)
::Guard::UI.stub(:warning)
::Guard::UI.stub(:error)
::Guard::UI.stub(:debug)
::Guard::UI.stub(:deprecation)
end
config.before(:all) do
::Guard::Notifier.send(:auto_detect_notification)
@guard_notify = ENV['GUARD_NOTIFY']
@guard_notifications = ::Guard::Notifier.notifications
end
config.after(:each) do
Pry.config.hooks.delete_hook(:when_started, :load_guard_rc)
if ::Guard.options
::Guard.options[:debug] = false
end
end
config.after(:all) do
ENV['GUARD_NOTIFY'] = @guard_notify
::Guard::Notifier.notifications = @guard_notifications
end
end