Skip to content

Commit

Permalink
fix vim file saving behavior
Browse files Browse the repository at this point in the history
only run when changed file has modifications
  • Loading branch information
killphi committed Dec 1, 2013
1 parent 8e0f0a4 commit e20657d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/guard/livereload.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def stop
reactor.stop
end

def run_on_changes(paths)
def run_on_modifications(paths)
sleep options[:grace_period]
reactor.reload_browser(paths)
end
Expand Down
6 changes: 3 additions & 3 deletions spec/lib/guard/livereload_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -100,17 +100,17 @@
end
end

describe "#run_on_changes" do
describe "#run_on_modifications" do
it "reloads browser" do
expect(reactor).to receive(:reload_browser).with(['foo'])
plugin.run_on_changes(['foo'])
plugin.run_on_modifications(['foo'])
end

it "can wait 0.5 seconds before reloading the browser" do
expect(reactor).to receive(:reload_browser).with(['foo'])
expect(plugin).to receive(:sleep).with(0.5)
plugin.options[:grace_period] = 0.5
plugin.run_on_changes(['foo'])
plugin.run_on_modifications(['foo'])
end
end
end

0 comments on commit e20657d

Please sign in to comment.