Skip to content

Commit

Permalink
FSEvents::Stream#shutdown.
Browse files Browse the repository at this point in the history
To shut down a stream, the stream should be stopped, invalidated, and released (taken from the example of 'taming the autotest beast with FSEvents').
  • Loading branch information
ymendel committed Jun 12, 2008
1 parent 9835efa commit f242e38
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/fsevents/stream.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,11 @@ def release
OSX.FSEventStreamRelease(stream)
@stream = nil
end

def shutdown
stop
invalidate
release
end
end
end
27 changes: 27 additions & 0 deletions spec/stream_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,33 @@
@stream.stream.should be_nil
end
end

it 'should shut down' do
@stream.should respond_to(:shutdown)
end

describe 'when shutting down' do
before :each do
@stream.stubs(:stop)
@stream.stubs(:invalidate)
@stream.stubs(:release)
end

it 'should stop' do
@stream.expects(:stop)
@stream.shutdown
end

it 'should invalidate' do
@stream.expects(:invalidate)
@stream.shutdown
end

it 'should release' do
@stream.expects(:release)
@stream.shutdown
end
end
end

describe FSEvents::Stream::StreamError do
Expand Down

0 comments on commit f242e38

Please sign in to comment.