-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add specs for synchronous producer (ensure exception is thrown)
- Loading branch information
Showing
2 changed files
with
26 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
require_relative '../../spec_helper' | ||
|
||
describe Nsq::Producer do | ||
context 'with a synchronous producer' do | ||
before do | ||
@cluster = NsqCluster.new(nsqd_count: 1) | ||
@nsqd = @cluster.nsqd.first | ||
@producer = new_producer(@nsqd, synchronous: true) | ||
end | ||
|
||
after do | ||
@producer.terminate if @producer | ||
@cluster.destroy | ||
end | ||
|
||
describe '#write' do | ||
it 'shouldn\'t raise an error when nsqd is down' do | ||
@nsqd.stop | ||
|
||
expect{ | ||
@producer.write('fail') | ||
}.to raise_error(RuntimeError, "No data from socket") | ||
end | ||
end | ||
end | ||
end |