Skip to content

Commit

Permalink
Adding #deleted_files to the events array.
Browse files Browse the repository at this point in the history
  • Loading branch information
ymendel committed Jul 2, 2008
1 parent 2532973 commit 78f8a3b
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/fsevents/ext/array.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,8 @@ def files
def modified_files
collect { |x| x.modified_files }.flatten
end

def deleted_files
collect { |x| x.deleted_files }.flatten
end
end
17 changes: 17 additions & 0 deletions spec/event_array_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,21 @@
@event_array.modified_files.should == files
end
end

it 'should return deleted files' do
@event_array.should respond_to(:deleted_files)
end

describe 'returning deleted files' do
it 'should collect deleted files from its events' do
events = Array.new(3) { stub('event', :deleted_files => Array.new(3) { stub('file') }) }
files = []
events.each do |event|
@event_array << event
files += event.deleted_files
end

@event_array.deleted_files.should == files
end
end
end

0 comments on commit 78f8a3b

Please sign in to comment.