Skip to content

Commit

Permalink
Adds queue and exchange deletion specs
Browse files Browse the repository at this point in the history
  • Loading branch information
arempe93 committed Jan 2, 2016
1 parent 320f216 commit 1202e97
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/bunny_mock/session.rb
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ def register_queue(queue)

# @private
def deregister_queue(queue)
@queues.delete queue.name
@queues.delete queue
end

# @private
Expand All @@ -147,7 +147,7 @@ def register_exchange(xchg)

# @private
def deregister_exchange(xchg)
@exchanges.delete xchg.name
@exchanges.delete xchg
end
end
end
13 changes: 13 additions & 0 deletions spec/unit/bunny_mock/exchange_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -156,4 +156,17 @@
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
12 changes: 12 additions & 0 deletions spec/unit/bunny_mock/queue_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -157,4 +157,16 @@
expect(@queue.message_count).to eq(0)
end
end

context '#delete' do

before do
@queue.delete
end

it 'should remove queue from session' do

expect(@session.queue_exists?(@queue.name)).to be_falsey
end
end
end

0 comments on commit 1202e97

Please sign in to comment.