Don't modify a frozen hash.
This commit is contained in:
parent
5352528530
commit
9cfe8d3635
@ -16,8 +16,7 @@ module Guard
|
||||
@listener = Listener.select_and_init
|
||||
@guards = []
|
||||
|
||||
options[:notify] = false if ENV["GUARD_NOTIFY"] == 'false'
|
||||
options[:notify] ? Notifier.turn_on : Notifier.turn_off
|
||||
!@options[:notify] || ENV["GUARD_NOTIFY"] == 'false' ? Notifier.turn_off : Notifier.turn_on
|
||||
|
||||
self
|
||||
end
|
||||
@ -61,7 +60,7 @@ module Guard
|
||||
guard.send(task_to_supervise, *args)
|
||||
rescue Exception
|
||||
UI.error("#{guard.class.name} guard failed to achieve its <#{task_to_supervise.to_s}> command: #{$!}")
|
||||
::Guard.guards.delete guard
|
||||
guards.delete guard
|
||||
UI.info("Guard #{guard.class.name} has just been fired")
|
||||
return $!
|
||||
end
|
||||
|
@ -38,14 +38,14 @@ describe Guard::Notifier do
|
||||
end
|
||||
|
||||
describe ".turn_off" do
|
||||
before(:each) { subject.turn_off }
|
||||
|
||||
if mac? && growl_installed?
|
||||
it "does nothing" do
|
||||
Growl.should_not_receive(:notify)
|
||||
subject.notify 'great', :title => 'Guard'
|
||||
end
|
||||
end
|
||||
|
||||
if linux? && libnotify_installed?
|
||||
elsif linux? && libnotify_installed?
|
||||
it "does nothing" do
|
||||
Libnotify.should_not_receive(:show)
|
||||
subject.notify 'great', :title => 'Guard'
|
||||
|
@ -4,6 +4,12 @@ describe Guard do
|
||||
|
||||
describe "Class Methods" do
|
||||
describe ".setup" do
|
||||
before(:each) do
|
||||
# set ENV["GUARD_NOTIFY"] to nil in case the user has ENV["GUARD_NOTIFY"] = 'false' set
|
||||
@old_env_guard_notify = ENV["GUARD_NOTIFY"]
|
||||
ENV["GUARD_NOTIFY"] = nil
|
||||
end
|
||||
after(:each) { ENV["GUARD_NOTIFY"] = @old_env_guard_notify }
|
||||
subject { ::Guard.setup }
|
||||
|
||||
it "should retrieve itself for chaining" do
|
||||
@ -36,7 +42,7 @@ describe Guard do
|
||||
it "should turn off notifier if env[GUARD_NOTIFY] is false" do
|
||||
::Guard::Notifier.should_receive(:turn_off)
|
||||
ENV["GUARD_NOTIFY"] = 'false'
|
||||
::Guard.setup(:notify => true)
|
||||
::Guard.setup({ :notify => true }.freeze)
|
||||
ENV["GUARD_NOTIFY"] = nil
|
||||
end
|
||||
end
|
||||
|
@ -15,7 +15,6 @@ RSpec.configure do |config|
|
||||
config.run_all_when_everything_filtered = true
|
||||
|
||||
config.before(:each) do
|
||||
Guard::Notifier.turn_off
|
||||
@fixture_path = Pathname.new(File.expand_path('../fixtures/', __FILE__))
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user