brightbox-warren 0.8.8 → 0.8.9
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +1 -0
- data/lib/warren/queue.rb +8 -0
- data/spec/warren/queue_spec.rb +18 -0
- data/warren.gemspec +2 -2
- metadata +2 -2
data/CHANGELOG
CHANGED
data/lib/warren/queue.rb
CHANGED
@@ -18,6 +18,12 @@ module Warren
|
|
18
18
|
#
|
19
19
|
NoAdapterSet = Class.new(Exception)
|
20
20
|
|
21
|
+
#
|
22
|
+
# Raised if the adapter is missing a method
|
23
|
+
# Check the message for details of the missing method.
|
24
|
+
#
|
25
|
+
InvalidAdapter = Class.new(Exception)
|
26
|
+
|
21
27
|
#
|
22
28
|
# Sets the current connection
|
23
29
|
#
|
@@ -57,6 +63,7 @@ module Warren
|
|
57
63
|
# Publishes the message to the queue
|
58
64
|
#
|
59
65
|
def self.publish *args, &blk
|
66
|
+
raise(InvalidAdapter, "publish method missing") unless @@adapter.respond_to?(:publish)
|
60
67
|
self.adapter.publish(*args, &blk)
|
61
68
|
end
|
62
69
|
|
@@ -64,6 +71,7 @@ module Warren
|
|
64
71
|
# Sends the subscribe message to the adapter class
|
65
72
|
#
|
66
73
|
def self.subscribe *args, &blk
|
74
|
+
raise(InvalidAdapter.new("subscribe method missing")) unless @@adapter.respond_to?(:subscribe)
|
67
75
|
self.adapter.subscribe(*args, &blk)
|
68
76
|
end
|
69
77
|
|
data/spec/warren/queue_spec.rb
CHANGED
@@ -34,6 +34,24 @@ describe Warren::Queue do
|
|
34
34
|
Warren::Queue.adapter.should == @adapter
|
35
35
|
end
|
36
36
|
|
37
|
+
it "should have a publish method" do
|
38
|
+
my_adapter = mock 'adapter'
|
39
|
+
Warren::Queue.adapter = my_adapter
|
40
|
+
|
41
|
+
lambda { Warren::Queue.publish }.should \
|
42
|
+
raise_error(Warren::Queue::InvalidAdapter, "publish method missing")
|
43
|
+
end
|
44
|
+
|
45
|
+
it "should have a subscribe method" do
|
46
|
+
my_adapter = mock 'adapter'
|
47
|
+
Warren::Queue.adapter = my_adapter
|
48
|
+
|
49
|
+
Warren::Queue.adapter.should == my_adapter
|
50
|
+
|
51
|
+
lambda { Warren::Queue.subscribe}.should \
|
52
|
+
raise_error(Warren::Queue::InvalidAdapter, "subscribe method missing")
|
53
|
+
end
|
54
|
+
|
37
55
|
it "should pass publish through to the adapter" do
|
38
56
|
@adapter.should_receive(:publish)
|
39
57
|
Warren::Queue.publish.should == "publish"
|
data/warren.gemspec
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{warren}
|
5
|
-
s.version = "0.8.
|
5
|
+
s.version = "0.8.9"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Caius Durling, David Smalley"]
|
9
|
-
s.date = %q{2009-07-
|
9
|
+
s.date = %q{2009-07-10}
|
10
10
|
s.description = %q{Library for pushing messages onto and off RabbitMQ queues}
|
11
11
|
s.email = %q{support@brightbox.co.uk}
|
12
12
|
s.extra_rdoc_files = ["CHANGELOG", "lib/warren/adapters/amqp_adapter.rb", "lib/warren/adapters/bunny_adapter.rb", "lib/warren/adapters/dummy_adapter.rb", "lib/warren/adapters/test_adapter.rb", "lib/warren/connection.rb", "lib/warren/filters/shared_secret.rb", "lib/warren/filters/yaml.rb", "lib/warren/message_filter.rb", "lib/warren/queue.rb", "lib/warren.rb", "LICENSE", "tasks/rdoc.rake", "tasks/rspec.rake"]
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: brightbox-warren
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Caius Durling, David Smalley
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-07-
|
12
|
+
date: 2009-07-10 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|