queue-bus 0.5.8 → 0.5.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9f3b0b469fc1b41f6483a838e8fc09bdf9fca9de
4
- data.tar.gz: 2edc3099b15987f9af4492c5c15d98783f4cda24
3
+ metadata.gz: e1b4c0ca9bf660b79b88769d6ba7e4d2d89e28f5
4
+ data.tar.gz: 2840967bb05b953171b300d28538d6b362332e6d
5
5
  SHA512:
6
- metadata.gz: 9f4de74f84b15b91a2ebdb5f555cf59b159e29049b599d2ba2f600662c61bd73009c402af651660c8c450d856c8b75774f7cdde77845413a60e189e65481ff3e
7
- data.tar.gz: 961bb8813a2e816e7c0cf01372a10b5c9ba562ac141bcca7a02412a67b96bdfae53f26f3687ca335e78754cc781d2732d6eadb66657e426bea25e56ee80b52bb
6
+ metadata.gz: 90dded1ee751e8d7773fbc183a8c8a0c430ec7dac927090fae6c775c05605c007b11e9a0595b0670f83becd6f5100b012d63ec77b34180d3ce9c802c995ca48e
7
+ data.tar.gz: 9ddb1c632db8dcd4ca2d298fe50b219485cc408c264eef073d17b0f61fe447c4de04aad9cece3c01f3952f8cd5e931626a0f5aedbd3a8e7380111775095ac938
@@ -27,6 +27,8 @@ module QueueBus
27
27
  end
28
28
 
29
29
  def add(sub)
30
+ raise "Duplicate key: #{sub.key} already exists " \
31
+ "in the #{sub.queue_name} queue!" if @subscriptions.key?(sub.key)
30
32
  @subscriptions[sub.key] = sub
31
33
  end
32
34
 
@@ -1,3 +1,3 @@
1
1
  module QueueBus
2
- VERSION = "0.5.8"
2
+ VERSION = "0.5.9"
3
3
  end
@@ -3,10 +3,12 @@ require 'spec_helper'
3
3
  module QueueBus
4
4
  describe SubscriptionList do
5
5
  describe ".from_redis" do
6
- it "should return from attributes" do
7
- mult = {"event_one" => {"class" => "MyClass", "queue_name" => "default", "key" => "event_one", "matcher" => {"bus_event_type" => "event_one"}},
8
- "event_two" => {"class" => "MyClass", "queue_name" => "else", "key" => "event_two", "matcher" => {"bus_event_type" => "event_two"}}}
6
+ let(:mult) do
7
+ {"event_one" => {"class" => "MyClass", "queue_name" => "default", "key" => "event_one", "matcher" => {"bus_event_type" => "event_one"}},
8
+ "event_two" => {"class" => "MyClass", "queue_name" => "else", "key" => "event_two", "matcher" => {"bus_event_type" => "event_two"}}}
9
+ end
9
10
 
11
+ it "should return from attributes" do
10
12
  list = SubscriptionList.from_redis(mult)
11
13
  list.size.should == 2
12
14
  one = list.key("event_one")
@@ -24,6 +26,13 @@ module QueueBus
24
26
  two.class_name.should == "MyClass"
25
27
  two.matcher.filters.should == {"bus_event_type" => "event_two"}
26
28
  end
29
+
30
+ it "raises an error if a subscription key already exists" do
31
+ mult["event_two"]["key"] = "event_one"
32
+
33
+ lambda { SubscriptionList.from_redis(mult) }
34
+ .should raise_error(RuntimeError)
35
+ end
27
36
  end
28
37
 
29
38
  describe "#to_redis" do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: queue-bus
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.8
4
+ version: 0.5.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Leonard
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-04-18 00:00:00.000000000 Z
11
+ date: 2018-10-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: multi_json