Skip to content

Commit

Permalink
FSEvents::Stream now creates FSEvents::Event objects to pass to the c…
Browse files Browse the repository at this point in the history
…allback (instead of just simple paths).
  • Loading branch information
ymendel committed Jun 15, 2008
1 parent e35f6bb commit b1d84c4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
2 changes: 1 addition & 1 deletion lib/fsevents/stream.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def stream_callback
paths.regard_as('*')

events = []
event_count.times { |i| events << paths[i] }
event_count.times { |i| events << Event.new(event_IDs[i], paths[i], self) }

callback.call(events)
end
Expand Down
17 changes: 11 additions & 6 deletions spec/stream_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -251,17 +251,22 @@
@proc.call(*@args)
end

it 'should collect the paths and pass them to the stored callback' do
it 'should collect the paths and IDs, create Event objects, and pass them to the stored callback' do
event_count = 3
@args_hash[:event_count] = event_count
paths = []
events = []
event_count.times do |i|
val = "/some/path/to/dir/number/#{i+1}"
@args_hash[:paths].push val
paths.push val
path = "/some/path/to/dir/number/#{i+1}"
id = i + 1
@args_hash[:paths].push path
@args_hash[:event_IDs].push id

event = stub("event #{path}")
FSEvents::Event.stubs(:new).with(id, path, @stream).returns(event)
events.push event
end
@args = @args_hash.values_at(*@callback_arg_order)
@callback.expects(:call).with(paths)
@callback.expects(:call).with(events)
@proc.call(*@args)
end
end
Expand Down

0 comments on commit b1d84c4

Please sign in to comment.