pivotal-moqueue 0.1.0.200907241602
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.rdoc +57 -0
- data/Rakefile +25 -0
- data/VERSION.yml +4 -0
- data/lib/moqueue.rb +15 -0
- data/lib/moqueue/fibers18.rb +57 -0
- data/lib/moqueue/matchers.rb +74 -0
- data/lib/moqueue/mock_broker.rb +44 -0
- data/lib/moqueue/mock_exchange.rb +114 -0
- data/lib/moqueue/mock_headers.rb +31 -0
- data/lib/moqueue/mock_queue.rb +126 -0
- data/lib/moqueue/object_methods.rb +31 -0
- data/lib/moqueue/overloads.rb +46 -0
- data/moqueue.gemspec +29 -0
- data/spec/examples/ack_spec.rb +60 -0
- data/spec/examples/basic_usage_spec.rb +101 -0
- data/spec/examples/example_helper.rb +16 -0
- data/spec/examples/logger_spec.rb +159 -0
- data/spec/examples/ping_pong_spec.rb +50 -0
- data/spec/examples/stocks_spec.rb +64 -0
- data/spec/spec.opts +1 -0
- data/spec/spec_helper.rb +21 -0
- data/spec/unit/matchers_spec.rb +92 -0
- data/spec/unit/mock_broker_spec.rb +34 -0
- data/spec/unit/mock_exchange_spec.rb +102 -0
- data/spec/unit/mock_headers_spec.rb +22 -0
- data/spec/unit/mock_queue_spec.rb +141 -0
- data/spec/unit/moqueue_spec.rb +9 -0
- data/spec/unit/object_methods_spec.rb +49 -0
- data/spec/unit/overloads_spec.rb +48 -0
- metadata +87 -0
@@ -0,0 +1,49 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../spec_helper'
|
2
|
+
|
3
|
+
describe ObjectMethods do
|
4
|
+
|
5
|
+
before(:each) do
|
6
|
+
reset_broker
|
7
|
+
@queue, @exchange = mock_queue_and_exchange
|
8
|
+
end
|
9
|
+
|
10
|
+
it "should reset the MockBroker" do
|
11
|
+
MockBroker.instance.expects(:reset!)
|
12
|
+
reset_broker
|
13
|
+
end
|
14
|
+
|
15
|
+
it "should name the queue ``anonymous-RANDOM_GARBAGE'' if not given a name" do
|
16
|
+
@queue.name.should match /anonymous\-[0-9a-f]{0,8}/
|
17
|
+
end
|
18
|
+
|
19
|
+
it "should name the queue with the name given" do
|
20
|
+
q, exchange = mock_queue_and_exchange("wassup")
|
21
|
+
q.name.should == "wassup"
|
22
|
+
q2 = mock_queue("watup")
|
23
|
+
q2.name.should == "watup"
|
24
|
+
end
|
25
|
+
|
26
|
+
it "should create a matched mock queue and mock exchange" do
|
27
|
+
ensure_deferred_block_called
|
28
|
+
@queue.subscribe do |message|
|
29
|
+
deferred_block_called
|
30
|
+
message.should == "FTW"
|
31
|
+
end
|
32
|
+
@exchange.publish("FTW")
|
33
|
+
end
|
34
|
+
|
35
|
+
it "should allow for overloading AMQP and MQ" do
|
36
|
+
overload_amqp
|
37
|
+
defined?(AMQP).should be_true
|
38
|
+
defined?(MQ).should be_true
|
39
|
+
end
|
40
|
+
|
41
|
+
it "should provide a convenience method for creating mock queues" do
|
42
|
+
mock_queue("Sugary").should be_kind_of(Moqueue::MockQueue)
|
43
|
+
end
|
44
|
+
|
45
|
+
it "should provide a convenience method for creating mock exchanges" do
|
46
|
+
mock_exchange(:topic => "sweetSugar").should be_kind_of(Moqueue::MockExchange)
|
47
|
+
end
|
48
|
+
|
49
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../spec_helper'
|
2
|
+
|
3
|
+
describe "AMQP and MQ", "when overloaded by moqueue/overloads" do
|
4
|
+
|
5
|
+
before(:all) do
|
6
|
+
overload_amqp
|
7
|
+
end
|
8
|
+
|
9
|
+
it "should make AMQP.start take options and a block without connecting to AMQP broker" do
|
10
|
+
ensure_deferred_block_called
|
11
|
+
AMQP.start(:host => "localhost") do
|
12
|
+
deferred_block_called
|
13
|
+
EM.stop
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
it "should run EM in AMQP.start" do
|
18
|
+
EM.expects(:run)
|
19
|
+
AMQP.start { EM.stop }
|
20
|
+
end
|
21
|
+
|
22
|
+
it "should provide a MQ.queue class method" do
|
23
|
+
MQ.queue('FTW').should be_a(Moqueue::MockQueue)
|
24
|
+
end
|
25
|
+
|
26
|
+
it "should emulate the behavior of MQ.closing?" do
|
27
|
+
ensure_deferred_block_called
|
28
|
+
AMQP.stop do
|
29
|
+
deferred_block_called
|
30
|
+
AMQP.should be_closing
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
it "should create topic exchanges" do
|
35
|
+
MQ.new.topic("lolzFTW").should == MockExchange.new(:topic => "lolzFTW")
|
36
|
+
end
|
37
|
+
|
38
|
+
it "should provide a MQ.fanout class method" do
|
39
|
+
MQ.fanout("fanout", :durable=>true).should be_a Moqueue::MockExchange
|
40
|
+
end
|
41
|
+
|
42
|
+
it "should create a named fanout queue via MQ.fanout" do
|
43
|
+
fanout = MQ.fanout("SayMyNameSayMyName", :durable=>true)
|
44
|
+
fanout.should be_a Moqueue::MockExchange
|
45
|
+
fanout.fanout.should == "SayMyNameSayMyName"
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
metadata
ADDED
@@ -0,0 +1,87 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: pivotal-moqueue
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0.200907241602
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Daniel DeLeo
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2009-07-09 00:00:00 -07:00
|
13
|
+
default_executable:
|
14
|
+
dependencies: []
|
15
|
+
|
16
|
+
description: Mocktacular Companion to AMQP Library. Happy TATFTing!
|
17
|
+
email: dan@kallistec.com
|
18
|
+
executables: []
|
19
|
+
|
20
|
+
extensions: []
|
21
|
+
|
22
|
+
extra_rdoc_files:
|
23
|
+
- README.rdoc
|
24
|
+
files:
|
25
|
+
- lib
|
26
|
+
- moqueue.gemspec
|
27
|
+
- Rakefile
|
28
|
+
- README.rdoc
|
29
|
+
- spec
|
30
|
+
- VERSION.yml
|
31
|
+
- lib/moqueue
|
32
|
+
- lib/moqueue/fibers18.rb
|
33
|
+
- lib/moqueue/matchers.rb
|
34
|
+
- lib/moqueue/mock_broker.rb
|
35
|
+
- lib/moqueue/mock_exchange.rb
|
36
|
+
- lib/moqueue/mock_headers.rb
|
37
|
+
- lib/moqueue/mock_queue.rb
|
38
|
+
- lib/moqueue/object_methods.rb
|
39
|
+
- lib/moqueue/overloads.rb
|
40
|
+
- lib/moqueue.rb
|
41
|
+
- spec/examples
|
42
|
+
- spec/examples/ack_spec.rb
|
43
|
+
- spec/examples/basic_usage_spec.rb
|
44
|
+
- spec/examples/example_helper.rb
|
45
|
+
- spec/examples/logger_spec.rb
|
46
|
+
- spec/examples/ping_pong_spec.rb
|
47
|
+
- spec/examples/stocks_spec.rb
|
48
|
+
- spec/spec.opts
|
49
|
+
- spec/spec_helper.rb
|
50
|
+
- spec/unit
|
51
|
+
- spec/unit/matchers_spec.rb
|
52
|
+
- spec/unit/mock_broker_spec.rb
|
53
|
+
- spec/unit/mock_exchange_spec.rb
|
54
|
+
- spec/unit/mock_headers_spec.rb
|
55
|
+
- spec/unit/mock_queue_spec.rb
|
56
|
+
- spec/unit/moqueue_spec.rb
|
57
|
+
- spec/unit/object_methods_spec.rb
|
58
|
+
- spec/unit/overloads_spec.rb
|
59
|
+
has_rdoc: false
|
60
|
+
homepage: http://github.com/danielsdeleo/moqueue
|
61
|
+
post_install_message:
|
62
|
+
rdoc_options:
|
63
|
+
- --inline-source
|
64
|
+
- --charset=UTF-8
|
65
|
+
require_paths:
|
66
|
+
- lib
|
67
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
68
|
+
requirements:
|
69
|
+
- - ">="
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
version: "0"
|
72
|
+
version:
|
73
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
74
|
+
requirements:
|
75
|
+
- - ">="
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: "0"
|
78
|
+
version:
|
79
|
+
requirements: []
|
80
|
+
|
81
|
+
rubyforge_project:
|
82
|
+
rubygems_version: 1.2.0
|
83
|
+
signing_key:
|
84
|
+
specification_version: 3
|
85
|
+
summary: Mocktacular Companion to AMQP Library. Happy TATFTing!
|
86
|
+
test_files: []
|
87
|
+
|