Fix preexisting tests after adding default hooks
This commit is contained in:
parent
bbc63abd5e
commit
1d38c59200
@ -62,8 +62,9 @@ module Guard
|
|||||||
# fire it if his work leads to a system failure
|
# fire it if his work leads to a system failure
|
||||||
def supervised_task(guard, task_to_supervise, *args)
|
def supervised_task(guard, task_to_supervise, *args)
|
||||||
guard.hook "#{task_to_supervise.to_s}_begin"
|
guard.hook "#{task_to_supervise.to_s}_begin"
|
||||||
guard.send(task_to_supervise, *args)
|
result = guard.send(task_to_supervise, *args)
|
||||||
guard.hook "#{task_to_supervise.to_s}_end"
|
guard.hook "#{task_to_supervise.to_s}_end"
|
||||||
|
result
|
||||||
rescue Exception
|
rescue Exception
|
||||||
UI.error("#{guard.class.name} guard failed to achieve its <#{task_to_supervise.to_s}> command: #{$!}")
|
UI.error("#{guard.class.name} guard failed to achieve its <#{task_to_supervise.to_s}> command: #{$!}")
|
||||||
::Guard.guards.delete guard
|
::Guard.guards.delete guard
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
module Guard
|
module Guard
|
||||||
class Guard
|
class Guard
|
||||||
|
include Hook
|
||||||
|
|
||||||
attr_accessor :watchers, :options
|
attr_accessor :watchers, :options
|
||||||
|
|
||||||
def initialize(watchers = [], options = {})
|
def initialize(watchers = [], options = {})
|
||||||
|
@ -54,7 +54,7 @@ describe Guard do
|
|||||||
describe ".supervised_task" do
|
describe ".supervised_task" do
|
||||||
subject { ::Guard.setup }
|
subject { ::Guard.setup }
|
||||||
before(:each) do
|
before(:each) do
|
||||||
@g = mock(Guard::Guard)
|
@g = mock(Guard::Guard).as_null_object
|
||||||
subject.guards.push(@g)
|
subject.guards.push(@g)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -92,6 +92,8 @@ describe Guard do
|
|||||||
failing_result.message.should == 'I break your system'
|
failing_result.message.should == 'I break your system'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "calls the default hooks"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user