Skip to content

Commit

Permalink
Better empty-cache behavior in Event#modified_files.
Browse files Browse the repository at this point in the history
It won't do for the event to raise an exception simply because nothing's been cached yet.
  • Loading branch information
ymendel committed Jun 30, 2008
1 parent e00a021 commit 6400f24
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/fsevents/event.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def modified_files
when :mtime
files.select { |f| File.mtime(f) >= stream.last_event }
when :cache
cache = stream.dirs[path]
cache = stream.dirs[path] || {}

files.select do |f|
cached = cache[f]
Expand Down
10 changes: 10 additions & 0 deletions spec/event_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,16 @@
modified_files.should_not include(file)
end
end

it 'should handle this path not yet cached' do
@dir_cache.delete(@path)
expected_files = @files
modified_files = @event.modified_files

expected_files.each do |file|
modified_files.should include(file)
end
end
end
end
end

0 comments on commit 6400f24

Please sign in to comment.