sidekiq-bus 0.5.10 → 0.6.0

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.
@@ -8,21 +8,21 @@ module QueueBus
8
8
  "event_two" => {"class" => "MyClass", "queue_name" => "else", "key" => "event_two", "matcher" => {"bus_event_type" => "event_two"}}}
9
9
 
10
10
  list = SubscriptionList.from_redis(mult)
11
- list.size.should == 2
11
+ expect(list.size).to eq(2)
12
12
  one = list.key("event_one")
13
13
  two = list.key("event_two")
14
14
 
15
- one.key.should == "event_one"
16
- one.key.should == "event_one"
17
- one.queue_name.should == "default"
18
- one.class_name.should == "MyClass"
19
- one.matcher.filters.should == {"bus_event_type" => "event_one"}
15
+ expect(one.key).to eq("event_one")
16
+ expect(one.key).to eq("event_one")
17
+ expect(one.queue_name).to eq("default")
18
+ expect(one.class_name).to eq("MyClass")
19
+ expect(one.matcher.filters).to eq({"bus_event_type" => "event_one"})
20
20
 
21
- two.key.should == "event_two"
22
- two.key.should == "event_two"
23
- two.queue_name.should == "else"
24
- two.class_name.should == "MyClass"
25
- two.matcher.filters.should == {"bus_event_type" => "event_two"}
21
+ expect(two.key).to eq("event_two")
22
+ expect(two.key).to eq("event_two")
23
+ expect(two.queue_name).to eq("else")
24
+ expect(two.class_name).to eq("MyClass")
25
+ expect(two.matcher.filters).to eq({"bus_event_type" => "event_two"})
26
26
  end
27
27
  end
28
28
 
@@ -33,9 +33,9 @@ module QueueBus
33
33
  list.add(Subscription.new("else_ok", "key2", "MyClass", {"bus_event_type" => "event_two"}))
34
34
 
35
35
  hash = list.to_redis
36
- hash.should == { "key1" => {"queue_name" => "default", "key" => "key1", "class" => "MyClass", "matcher" => {"bus_event_type" => "event_one"}},
36
+ expect(hash).to eq({ "key1" => {"queue_name" => "default", "key" => "key1", "class" => "MyClass", "matcher" => {"bus_event_type" => "event_one"}},
37
37
  "key2" => {"queue_name" => "else_ok", "key" => "key2", "class" => "MyClass", "matcher" => {"bus_event_type" => "event_two"}}
38
- }
38
+ })
39
39
 
40
40
  end
41
41
  end
@@ -3,27 +3,27 @@ require 'spec_helper'
3
3
  module QueueBus
4
4
  describe Subscription do
5
5
  it "should normalize the queue name" do
6
- Subscription.new("test", "my_event", "MyClass", {}, nil).queue_name.should == "test"
7
- Subscription.new("tes t", "my_event", "MyClass", {}, nil).queue_name.should == "tes_t"
8
- Subscription.new("t%s", "my_event", "MyClass", {}, nil).queue_name.should == "t_s"
6
+ expect(Subscription.new("test", "my_event", "MyClass", {}, nil).queue_name).to eq("test")
7
+ expect(Subscription.new("tes t", "my_event", "MyClass", {}, nil).queue_name).to eq("tes_t")
8
+ expect(Subscription.new("t%s", "my_event", "MyClass", {}, nil).queue_name).to eq("t_s")
9
9
  end
10
10
 
11
11
  describe ".register" do
12
12
  it "should take in args from dispatcher" do
13
13
  executor = Proc.new { |attributes| }
14
14
  sub = Subscription.register("queue_name", "mykey", "MyClass", {"bus_event_type" => "my_event"}, executor)
15
- sub.send(:executor).should == executor
16
- sub.matcher.filters.should == {"bus_event_type" => "my_event"}
17
- sub.queue_name.should == "queue_name"
18
- sub.key.should == "mykey"
19
- sub.class_name.should == "MyClass"
15
+ expect(sub.send(:executor)).to eq(executor)
16
+ expect(sub.matcher.filters).to eq({"bus_event_type" => "my_event"})
17
+ expect(sub.queue_name).to eq("queue_name")
18
+ expect(sub.key).to eq("mykey")
19
+ expect(sub.class_name).to eq("MyClass")
20
20
  end
21
21
  end
22
22
 
23
23
  describe "#execute!" do
24
24
  it "should call the executor with the attributes" do
25
25
  exec = Object.new
26
- exec.should_receive(:call)
26
+ expect(exec).to receive(:call)
27
27
 
28
28
  sub = Subscription.new("x", "y", "ClassName", {}, exec)
29
29
  sub.execute!({"ok" => true})
@@ -33,19 +33,19 @@ module QueueBus
33
33
  describe "#to_redis" do
34
34
  it "should return what to store for this subscription" do
35
35
  sub = Subscription.new("queue_one", "xyz", "ClassName", {"bus_event_type" => "my_event"}, nil)
36
- sub.to_redis.should == {"queue_name" => "queue_one", "key" => "xyz", "class" => "ClassName", "matcher" => {"bus_event_type" => "my_event"}}
36
+ expect(sub.to_redis).to eq({"queue_name" => "queue_one", "key" => "xyz", "class" => "ClassName", "matcher" => {"bus_event_type" => "my_event"}})
37
37
  end
38
38
  end
39
39
 
40
40
  describe "#matches?" do
41
41
  it "should do pattern stuff" do
42
- Subscription.new("x", "id", "ClassName", {"bus_event_type" => "one"}).matches?("bus_event_type" => "one").should == true
43
- Subscription.new("x", "id", "ClassName", {"bus_event_type" => "one"}).matches?("bus_event_type" => "onex").should == false
44
- Subscription.new("x", "id", "ClassName", {"bus_event_type" => "^one.*$"}).matches?("bus_event_type" => "onex").should == true
45
- Subscription.new("x", "id", "ClassName", {"bus_event_type" => "one.*"}).matches?("bus_event_type" => "onex").should == true
46
- Subscription.new("x", "id", "ClassName", {"bus_event_type" => "one.?"}).matches?("bus_event_type" => "onex").should == true
47
- Subscription.new("x", "id", "ClassName", {"bus_event_type" => "one.?"}).matches?("bus_event_type" => "one").should == true
48
- Subscription.new("x", "id", "ClassName", {"bus_event_type" => "\\"}).matches?("bus_event_type" => "one").should == false
42
+ expect(Subscription.new("x", "id", "ClassName", {"bus_event_type" => "one"}).matches?("bus_event_type" => "one")).to eq(true)
43
+ expect(Subscription.new("x", "id", "ClassName", {"bus_event_type" => "one"}).matches?("bus_event_type" => "onex")).to eq(false)
44
+ expect(Subscription.new("x", "id", "ClassName", {"bus_event_type" => "^one.*$"}).matches?("bus_event_type" => "onex")).to eq(true)
45
+ expect(Subscription.new("x", "id", "ClassName", {"bus_event_type" => "one.*"}).matches?("bus_event_type" => "onex")).to eq(true)
46
+ expect(Subscription.new("x", "id", "ClassName", {"bus_event_type" => "one.?"}).matches?("bus_event_type" => "onex")).to eq(true)
47
+ expect(Subscription.new("x", "id", "ClassName", {"bus_event_type" => "one.?"}).matches?("bus_event_type" => "one")).to eq(true)
48
+ expect(Subscription.new("x", "id", "ClassName", {"bus_event_type" => "\\"}).matches?("bus_event_type" => "one")).to eq(false)
49
49
  end
50
50
  end
51
51
 
data/spec/worker_spec.rb CHANGED
@@ -4,28 +4,28 @@ module QueueBus
4
4
  describe Worker do
5
5
  it "should proxy to given class" do
6
6
  hash = {"bus_class_proxy" => "QueueBus::Driver", "ok" => true}
7
- QueueBus::Driver.should_receive(:perform).with(hash)
7
+ expect(QueueBus::Driver).to receive(:perform).with(hash)
8
8
  QueueBus::Worker.perform(JSON.generate(hash))
9
9
  end
10
10
 
11
11
  it "should use instance" do
12
12
  hash = {"bus_class_proxy" => "QueueBus::Rider", "ok" => true}
13
- QueueBus::Rider.should_receive(:perform).with(hash)
13
+ expect(QueueBus::Rider).to receive(:perform).with(hash)
14
14
  QueueBus::Worker.new.perform(JSON.generate(hash))
15
15
  end
16
16
 
17
17
  it "should not freak out if class not there anymore" do
18
18
  hash = {"bus_class_proxy" => "QueueBus::BadClass", "ok" => true}
19
19
 
20
- QueueBus::Worker.perform(JSON.generate(hash)).should == nil
20
+ expect(QueueBus::Worker.perform(JSON.generate(hash))).to eq(nil)
21
21
  end
22
22
 
23
23
  it "should raise error if proxy raises error" do
24
24
  hash = {"bus_class_proxy" => "QueueBus::Rider", "ok" => true}
25
- QueueBus::Rider.should_receive(:perform).with(hash).and_raise("rider crash")
26
- lambda {
25
+ expect(QueueBus::Rider).to receive(:perform).with(hash).and_raise("rider crash")
26
+ expect {
27
27
  QueueBus::Worker.perform(JSON.generate(hash))
28
- }.should raise_error("rider crash")
28
+ }.to raise_error("rider crash")
29
29
  end
30
30
  end
31
31
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sidekiq-bus
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.10
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Leonard
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-10-17 00:00:00.000000000 Z
11
+ date: 2019-05-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: queue-bus
@@ -164,6 +164,7 @@ files:
164
164
  - spec/publish_spec.rb
165
165
  - spec/publisher_spec.rb
166
166
  - spec/rider_spec.rb
167
+ - spec/sidekiq_bus_spec.rb
167
168
  - spec/spec_helper.rb
168
169
  - spec/subscriber_spec.rb
169
170
  - spec/subscription_list_spec.rb
@@ -206,6 +207,7 @@ test_files:
206
207
  - spec/publish_spec.rb
207
208
  - spec/publisher_spec.rb
208
209
  - spec/rider_spec.rb
210
+ - spec/sidekiq_bus_spec.rb
209
211
  - spec/spec_helper.rb
210
212
  - spec/subscriber_spec.rb
211
213
  - spec/subscription_list_spec.rb