spec/unit/bunny_mock/exchange_spec.rb in bunny-mock-1.0.0 vs spec/unit/bunny_mock/exchange_spec.rb in bunny-mock-1.1.0

- old
+ new

@@ -48,10 +48,15 @@ @receiver.bind @source.name expect(@receiver.bound_to?(@source)).to be_truthy expect(@source.has_binding?(@receiver)).to be_truthy end + + it 'should raise error when exchange does not exists' do + + expect { @receiver.bind('this.xchg.does.not.exist') }.to raise_exception(BunnyMock::NotFound) + end end context '#unbind' do before do @@ -74,10 +79,15 @@ @receiver.unbind @source.name expect(@receiver.bound_to?(@source)).to be_falsey expect(@source.has_binding?(@receiver)).to be_falsey end + + it 'should raise error when exchange does not exists' do + + expect { @receiver.unbind('this.xchg.does.not.exist') }.to raise_exception(BunnyMock::NotFound) + end end context '#bound_to?' do before do @@ -112,10 +122,15 @@ it 'return false otherwise' do expect(@receiver.bound_to?(@source)).to be_falsey end + + it 'should raise error when exchange does not exists' do + + expect { @receiver.bound_to?('this.xchg.does.not.exist') }.to raise_exception(BunnyMock::NotFound) + end end context '#has_binding?' do before do @@ -140,6 +155,18 @@ expect(@receiver.bound_to?(@source)).to be_falsey expect(@source.has_binding?(@receiver)).to be_falsey end end + context '#delete' do + + before do + @exchange = @channel.direct 'xchg.direct' + @exchange.delete + end + + it 'should remove exchange from session' do + + expect(@session.exchange_exists?(@exchange.name)).to be_falsey + end + end end