diff --git a/lib/watchr/controller.rb b/lib/watchr/controller.rb index 0297161..fbdcfd0 100644 --- a/lib/watchr/controller.rb +++ b/lib/watchr/controller.rb @@ -59,7 +59,7 @@ def update(path, event_type = nil) path = Pathname(path).expand_path Watchr.debug("received #{event_type.inspect} event for #{path.relative_path_from(Pathname(Dir.pwd))}") - if path == @script.path && event_type != :accessed + if path == @script.path && (event_type != :accessed && event_type != :deleted) @script.parse! @handler.refresh(monitored_paths) else diff --git a/test/test_controller.rb b/test/test_controller.rb index e494bf1..1ee5775 100644 --- a/test/test_controller.rb +++ b/test/test_controller.rb @@ -117,5 +117,13 @@ def setup @controller.update('abc', :accessed) end + + test "does not parse script on deletion" do + path = to_p('abc') + @script.stubs(:path).returns(path) + @script.expects(:parse!).never + + @controller.update('abc', :deleted) + end end