Skip to content

Instantly share code, notes, and snippets.

@roidrage
Created October 15, 2010 15:35
Show Gist options
  • Save roidrage/628393 to your computer and use it in GitHub Desktop.
Save roidrage/628393 to your computer and use it in GitHub Desktop.
before(:each) do
@fanout = mock("fanout")
@binding = mock("binding", :subscribe => true)
@queue = mock("queue", :bind => @binding, :publish => true)
@amq = mock("AMPQueue", :queue => @queue, :fanout => @fanout)
@serializer = mock("Serializer", :dump => "dumped_value")
@target = mock("Target of Request")
@reaper = mock("Reaper")
Nanite::Reaper.stub!(:new).and_return(@reaper)
@request_without_target = mock("Request", :target => nil, :token => "Token",
:reply_to => "Reply To", :from => "From", :persistent => true, :identity => "Identity",
:payload => "Payload", :to_s => nil)
@request_with_target = mock("Request", :target => "Target", :token => "Token",
:reply_to => "Reply To", :from => "From", :persistent => true, :payload => "Payload", :to_s => nil)
@mapper_with_target = mock("Mapper", :identity => "id")
@mapper_without_target = mock("Mapper", :request => false, :identity => @request_without_target.identity)
@cluster_with_target = Nanite::Cluster.new(@amq, 32, "the_identity", @serializer, @mapper_with_target)
@cluster_without_target = Nanite::Cluster.new(@amq, 32, "the_identity", @serializer, @mapper_without_target)
Nanite::Cluster.stub!(:mapper).and_return(@mapper)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment