push method returns executing Promise

This commit is contained in:
jway 2014-10-07 15:27:36 -07:00
parent a08cfaa155
commit 3151b3ef4b
2 changed files with 2 additions and 2 deletions

View File

@ -37,7 +37,7 @@ module Hermann
# data to the kafka broker. Upon execution the Promise's status # data to the kafka broker. Upon execution the Promise's status
# will be set # will be set
def push_single(msg) def push_single(msg)
Concurrent::Promise.new { Concurrent::Promise.execute {
data = ProducerUtil::KeyedMessage.new(@topic, msg) data = ProducerUtil::KeyedMessage.new(@topic, msg)
@producer.send(data) @producer.send(data)
} }

View File

@ -13,7 +13,7 @@ describe Hermann::Provider::JavaProducer do
context 'error conditions' do context 'error conditions' do
shared_examples 'an error condition' do shared_examples 'an error condition' do
it 'should be rejected' do it 'should be rejected' do
promise = producer.push_single('rspec').execute.wait(1) promise = producer.push_single('rspec').wait(1)
expect(promise).to be_rejected expect(promise).to be_rejected
expect { promise.value! }.to raise_error expect { promise.value! }.to raise_error
end end