Skip to content

added basic support for MockQueue#unsubscribe #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/moqueue/mock_queue.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def received_routing_key?(key)
end

def unsubscribe
true
@subscribe_block = nil
end

def prefetch(size)
Expand Down
7 changes: 7 additions & 0 deletions spec/unit/mock_queue_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,13 @@
@queue.should respond_to(:unsubscribe)
end

it "should prevent double subscribe errors if unsubscribe is called inbetween" do
@queue.subscribe { |msg| "once" }
@queue.unsubscribe
@queue.subscribe { |msg| "second" }.should_not raise_error(DoubleSubscribeError)
end


it "should ignore #prefetch but at least raise an error" do
lambda { @queue.prefetch(1337) }.should_not raise_error
end
Expand Down