Skip to content

Commit

Permalink
Stream-start will raise an exception on error.
Browse files Browse the repository at this point in the history
  • Loading branch information
ymendel committed Jun 12, 2008
1 parent a12b52a commit 761dba4
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/fsevents/stream.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def schedule
end

def start
OSX.FSEventStreamStart(stream)
OSX.FSEventStreamStart(stream) or raise StreamError, 'Could not start stream'
end

def startup
Expand Down
15 changes: 14 additions & 1 deletion spec/stream_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -198,10 +198,23 @@
end

describe 'when starting' do
before :each do
OSX.stubs(:FSEventStreamStart).returns(true)
end

it 'should start the stream' do
OSX.expects(:FSEventStreamStart).with(@stream.stream)
OSX.expects(:FSEventStreamStart).with(@stream.stream).returns(true)
@stream.start
end

it 'should raise a StreamError exception if the stream could not be started' do
OSX.stubs(:FSEventStreamStart).returns(nil)
lambda { @stream.start }.should raise_error(FSEvents::Stream::StreamError)
end

it 'should not raise a StreamError exception if the stream could be started' do
lambda { @stream.start }.should_not raise_error(FSEvents::Stream::StreamError)
end
end

it 'should stop itself' do
Expand Down

0 comments on commit 761dba4

Please sign in to comment.