resque-bus 0.3.7 → 0.5.7
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/.gitignore +1 -0
- data/Gemfile +2 -2
- data/README.mdown +42 -64
- data/Rakefile +0 -1
- data/lib/resque-bus.rb +13 -305
- data/lib/resque_bus/adapter.rb +65 -0
- data/lib/resque_bus/compatibility/deprecated.rb +38 -0
- data/lib/resque_bus/compatibility/driver.rb +10 -0
- data/lib/resque_bus/compatibility/heartbeat.rb +10 -0
- data/lib/resque_bus/compatibility/publisher.rb +13 -0
- data/lib/resque_bus/compatibility/rider.rb +32 -0
- data/lib/resque_bus/compatibility/subscriber.rb +8 -0
- data/lib/resque_bus/compatibility/task_manager.rb +8 -0
- data/lib/resque_bus/server/views/bus.erb +2 -2
- data/lib/resque_bus/server.rb +5 -4
- data/lib/resque_bus/tasks.rb +46 -46
- data/lib/resque_bus/version.rb +2 -4
- data/resque-bus.gemspec +5 -10
- data/spec/adapter/compatibility_spec.rb +97 -0
- data/spec/adapter/integration_spec.rb +111 -0
- data/spec/adapter/publish_at_spec.rb +50 -0
- data/spec/adapter/retry_spec.rb +47 -0
- data/spec/adapter/support.rb +23 -0
- data/spec/adapter_spec.rb +14 -0
- data/spec/application_spec.rb +62 -62
- data/spec/config_spec.rb +83 -0
- data/spec/dispatch_spec.rb +6 -6
- data/spec/driver_spec.rb +62 -44
- data/spec/heartbeat_spec.rb +4 -4
- data/spec/integration_spec.rb +2 -2
- data/spec/matcher_spec.rb +29 -29
- data/spec/publish_spec.rb +46 -43
- data/spec/publisher_spec.rb +7 -0
- data/spec/rider_spec.rb +14 -66
- data/spec/spec_helper.rb +25 -25
- data/spec/subscriber_spec.rb +194 -176
- data/spec/subscription_list_spec.rb +1 -1
- data/spec/subscription_spec.rb +1 -1
- data/spec/worker_spec.rb +32 -0
- metadata +47 -58
- data/lib/resque_bus/application.rb +0 -115
- data/lib/resque_bus/compatibility.rb +0 -24
- data/lib/resque_bus/dispatch.rb +0 -61
- data/lib/resque_bus/driver.rb +0 -30
- data/lib/resque_bus/heartbeat.rb +0 -106
- data/lib/resque_bus/local.rb +0 -38
- data/lib/resque_bus/matcher.rb +0 -81
- data/lib/resque_bus/publisher.rb +0 -12
- data/lib/resque_bus/rider.rb +0 -54
- data/lib/resque_bus/subscriber.rb +0 -63
- data/lib/resque_bus/subscription.rb +0 -55
- data/lib/resque_bus/subscription_list.rb +0 -53
- data/lib/resque_bus/task_manager.rb +0 -52
- data/lib/resque_bus/util.rb +0 -42
- data/lib/tasks/resquebus.rake +0 -2
- data/spec/compatibility_spec.rb +0 -93
- data/spec/publish_at_spec.rb +0 -74
- data/spec/redis_spec.rb +0 -13
data/spec/matcher_spec.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
module
|
3
|
+
module QueueBus
|
4
4
|
describe Matcher do
|
5
5
|
it "should already return false on empty filters" do
|
6
6
|
matcher = Matcher.new({})
|
@@ -8,19 +8,19 @@ module ResqueBus
|
|
8
8
|
matcher.matches?(nil).should == false
|
9
9
|
matcher.matches?("name" => "val").should == false
|
10
10
|
end
|
11
|
-
|
11
|
+
|
12
12
|
it "should not crash if nil inputs" do
|
13
13
|
matcher = Matcher.new("name" => "val")
|
14
14
|
matcher.matches?(nil).should == false
|
15
15
|
end
|
16
|
-
|
16
|
+
|
17
17
|
it "string filter to/from redis" do
|
18
18
|
matcher = Matcher.new("name" => "val")
|
19
19
|
matcher.matches?("name" => "val").should == true
|
20
20
|
matcher.matches?("name" => " val").should == false
|
21
21
|
matcher.matches?("name" => "zval").should == false
|
22
22
|
end
|
23
|
-
|
23
|
+
|
24
24
|
it "regex filter" do
|
25
25
|
matcher = Matcher.new("name" => /^[cb]a+t/)
|
26
26
|
matcher.matches?("name" => "cat").should == true
|
@@ -29,7 +29,7 @@ module ResqueBus
|
|
29
29
|
matcher.matches?("name" => "ct").should == false
|
30
30
|
matcher.matches?("name" => "bcat").should == false
|
31
31
|
end
|
32
|
-
|
32
|
+
|
33
33
|
it "present filter" do
|
34
34
|
matcher = Matcher.new("name" => :present)
|
35
35
|
matcher.matches?("name" => "").should == false
|
@@ -37,7 +37,7 @@ module ResqueBus
|
|
37
37
|
matcher.matches?("name" => "bear").should == true
|
38
38
|
matcher.matches?("other" => "bear").should == false
|
39
39
|
end
|
40
|
-
|
40
|
+
|
41
41
|
it "blank filter" do
|
42
42
|
matcher = Matcher.new("name" => :blank)
|
43
43
|
matcher.matches?("name" => nil).should == true
|
@@ -47,7 +47,7 @@ module ResqueBus
|
|
47
47
|
matcher.matches?("name" => "bear").should == false
|
48
48
|
matcher.matches?("name" => " s ").should == false
|
49
49
|
end
|
50
|
-
|
50
|
+
|
51
51
|
it "nil filter" do
|
52
52
|
matcher = Matcher.new("name" => :nil)
|
53
53
|
matcher.matches?("name" => nil).should == true
|
@@ -56,7 +56,7 @@ module ResqueBus
|
|
56
56
|
matcher.matches?("name" => " ").should == false
|
57
57
|
matcher.matches?("name" => "bear").should == false
|
58
58
|
end
|
59
|
-
|
59
|
+
|
60
60
|
it "key filter" do
|
61
61
|
matcher = Matcher.new("name" => :key)
|
62
62
|
matcher.matches?("name" => nil).should == true
|
@@ -65,7 +65,7 @@ module ResqueBus
|
|
65
65
|
matcher.matches?("name" => " ").should == true
|
66
66
|
matcher.matches?("name" => "bear").should == true
|
67
67
|
end
|
68
|
-
|
68
|
+
|
69
69
|
it "empty filter" do
|
70
70
|
matcher = Matcher.new("name" => :empty)
|
71
71
|
matcher.matches?("name" => nil).should == false
|
@@ -75,7 +75,7 @@ module ResqueBus
|
|
75
75
|
matcher.matches?("name" => "bear").should == false
|
76
76
|
matcher.matches?("name" => " s ").should == false
|
77
77
|
end
|
78
|
-
|
78
|
+
|
79
79
|
it "value filter" do
|
80
80
|
matcher = Matcher.new("name" => :value)
|
81
81
|
matcher.matches?("name" => nil).should == false
|
@@ -85,7 +85,7 @@ module ResqueBus
|
|
85
85
|
matcher.matches?("name" => "bear").should == true
|
86
86
|
matcher.matches?("name" => " s ").should == true
|
87
87
|
end
|
88
|
-
|
88
|
+
|
89
89
|
it "multiple filters" do
|
90
90
|
matcher = Matcher.new("name" => /^[cb]a+t/, "state" => "sleeping")
|
91
91
|
matcher.matches?("state" => "sleeping", "name" => "cat").should == true
|
@@ -94,7 +94,7 @@ module ResqueBus
|
|
94
94
|
matcher.matches?("state" => "sleeping", "name" => "bear").should == false
|
95
95
|
matcher.matches?("state" => "awake", "name" => "bear").should == false
|
96
96
|
end
|
97
|
-
|
97
|
+
|
98
98
|
it "regex should go back and forth into redis" do
|
99
99
|
matcher = Matcher.new("name" => /^[cb]a+t/)
|
100
100
|
matcher.matches?("name" => "cat").should == true
|
@@ -102,40 +102,40 @@ module ResqueBus
|
|
102
102
|
matcher.matches?("name" => "caaaaat").should == true
|
103
103
|
matcher.matches?("name" => "ct").should == false
|
104
104
|
matcher.matches?("name" => "bcat").should == false
|
105
|
-
|
106
|
-
|
107
|
-
redis =
|
108
|
-
matcher = Matcher.new(
|
105
|
+
|
106
|
+
QueueBus.redis { |redis| redis.set("temp1", QueueBus::Util.encode(matcher.to_redis) ) }
|
107
|
+
redis = QueueBus.redis { |redis| redis.get("temp1") }
|
108
|
+
matcher = Matcher.new(QueueBus::Util.decode(redis))
|
109
109
|
matcher.matches?("name" => "cat").should == true
|
110
110
|
matcher.matches?("name" => "bat").should == true
|
111
111
|
matcher.matches?("name" => "caaaaat").should == true
|
112
112
|
matcher.matches?("name" => "ct").should == false
|
113
113
|
matcher.matches?("name" => "bcat").should == false
|
114
|
-
|
115
|
-
|
116
|
-
redis =
|
117
|
-
matcher = Matcher.new(
|
114
|
+
|
115
|
+
QueueBus.redis { |redis| redis.set("temp2", QueueBus::Util.encode(matcher.to_redis) ) }
|
116
|
+
redis = QueueBus.redis { |redis| redis.get("temp2") }
|
117
|
+
matcher = Matcher.new(QueueBus::Util.decode(redis))
|
118
118
|
matcher.matches?("name" => "cat").should == true
|
119
119
|
matcher.matches?("name" => "bat").should == true
|
120
120
|
matcher.matches?("name" => "caaaaat").should == true
|
121
121
|
matcher.matches?("name" => "ct").should == false
|
122
122
|
matcher.matches?("name" => "bcat").should == false
|
123
123
|
end
|
124
|
-
|
124
|
+
|
125
125
|
it "special value should go back and forth into redis" do
|
126
126
|
matcher = Matcher.new("name" => :blank)
|
127
127
|
matcher.matches?("name" => "cat").should == false
|
128
128
|
matcher.matches?("name" => "").should == true
|
129
|
-
|
130
|
-
|
131
|
-
redis
|
132
|
-
matcher = Matcher.new(
|
129
|
+
|
130
|
+
QueueBus.redis { |redis| redis.set("temp1", QueueBus::Util.encode(matcher.to_redis) ) }
|
131
|
+
redis= QueueBus.redis { |redis| redis.get("temp1") }
|
132
|
+
matcher = Matcher.new(QueueBus::Util.decode(redis))
|
133
133
|
matcher.matches?("name" => "cat").should == false
|
134
134
|
matcher.matches?("name" => "").should == true
|
135
|
-
|
136
|
-
|
137
|
-
redis
|
138
|
-
matcher = Matcher.new(
|
135
|
+
|
136
|
+
QueueBus.redis { |redis| redis.set("temp2", QueueBus::Util.encode(matcher.to_redis) ) }
|
137
|
+
redis= QueueBus.redis { |redis| redis.get("temp2") }
|
138
|
+
matcher = Matcher.new(QueueBus::Util.decode(redis))
|
139
139
|
matcher.matches?("name" => "cat").should == false
|
140
140
|
matcher.matches?("name" => "").should == true
|
141
141
|
end
|
data/spec/publish_spec.rb
CHANGED
@@ -1,93 +1,96 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe "Publishing an event" do
|
4
|
-
|
4
|
+
|
5
5
|
before(:each) do
|
6
6
|
Timecop.freeze
|
7
|
-
|
7
|
+
QueueBus.stub(:generate_uuid).and_return("idfhlkj")
|
8
8
|
end
|
9
9
|
after(:each) do
|
10
10
|
Timecop.return
|
11
11
|
end
|
12
|
-
let(:bus_attrs) { {"
|
12
|
+
let(:bus_attrs) { {"bus_class_proxy"=>"QueueBus::Driver",
|
13
|
+
"bus_published_at" => Time.now.to_i,
|
13
14
|
"bus_id"=>"#{Time.now.to_i}-idfhlkj",
|
14
15
|
"bus_app_hostname" => `hostname 2>&1`.strip.sub(/.local/,'')} }
|
15
|
-
|
16
|
+
|
16
17
|
it "should add it to Redis" do
|
17
18
|
hash = {:one => 1, "two" => "here", "id" => 12 }
|
18
19
|
event_name = "event_name"
|
19
|
-
|
20
|
-
val =
|
20
|
+
|
21
|
+
val = QueueBus.redis { |redis| redis.lpop("queue:bus_incoming") }
|
21
22
|
val.should == nil
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
val =
|
23
|
+
|
24
|
+
QueueBus.publish(event_name, hash)
|
25
|
+
|
26
|
+
val = QueueBus.redis { |redis| redis.lpop("queue:bus_incoming") }
|
26
27
|
hash = JSON.parse(val)
|
27
|
-
hash["class"].should == "
|
28
|
-
hash["args"].should ==
|
29
|
-
|
28
|
+
hash["class"].should == "QueueBus::Worker"
|
29
|
+
hash["args"].size.should == 1
|
30
|
+
JSON.parse(hash["args"].first).should == {"bus_event_type" => event_name, "two"=>"here", "one"=>1, "id" => 12}.merge(bus_attrs)
|
31
|
+
|
30
32
|
end
|
31
|
-
|
33
|
+
|
32
34
|
it "should use the id if given" do
|
33
35
|
hash = {:one => 1, "two" => "here", "bus_id" => "app-given" }
|
34
36
|
event_name = "event_name"
|
35
|
-
|
36
|
-
val =
|
37
|
+
|
38
|
+
val = QueueBus.redis { |redis| redis.lpop("queue:bus_incoming") }
|
37
39
|
val.should == nil
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
val =
|
40
|
+
|
41
|
+
QueueBus.publish(event_name, hash)
|
42
|
+
|
43
|
+
val = QueueBus.redis { |redis| redis.lpop("queue:bus_incoming") }
|
42
44
|
hash = JSON.parse(val)
|
43
|
-
hash["class"].should == "
|
44
|
-
hash["args"].should ==
|
45
|
+
hash["class"].should == "QueueBus::Worker"
|
46
|
+
hash["args"].size.should == 1
|
47
|
+
JSON.parse(hash["args"].first).should == {"bus_event_type" => event_name, "two"=>"here", "one"=>1}.merge(bus_attrs).merge("bus_id" => 'app-given')
|
45
48
|
end
|
46
|
-
|
49
|
+
|
47
50
|
it "should add metadata via callback" do
|
48
51
|
myval = 0
|
49
|
-
|
52
|
+
QueueBus.before_publish = lambda { |att|
|
50
53
|
att["mine"] = 4
|
51
54
|
myval += 1
|
52
55
|
}
|
53
56
|
|
54
57
|
hash = {:one => 1, "two" => "here", "bus_id" => "app-given" }
|
55
58
|
event_name = "event_name"
|
56
|
-
|
57
|
-
val =
|
59
|
+
|
60
|
+
val = QueueBus.redis { |redis| redis.lpop("queue:bus_incoming") }
|
58
61
|
val.should == nil
|
59
|
-
|
60
|
-
|
62
|
+
|
63
|
+
QueueBus.publish(event_name, hash)
|
61
64
|
|
62
65
|
|
63
|
-
val =
|
66
|
+
val = QueueBus.redis { |redis| redis.lpop("queue:bus_incoming") }
|
64
67
|
hash = JSON.parse(val)
|
65
|
-
att = hash["args"].first
|
68
|
+
att = JSON.parse(hash["args"].first)
|
66
69
|
att["mine"].should == 4
|
67
70
|
myval.should == 1
|
68
71
|
end
|
69
|
-
|
72
|
+
|
70
73
|
it "should set the timezone and locale if available" do
|
71
74
|
defined?(I18n).should be_nil
|
72
|
-
Time.respond_to?(:zone).should
|
73
|
-
|
75
|
+
Time.respond_to?(:zone).should eq(false)
|
76
|
+
|
74
77
|
stub_const("I18n", Class.new)
|
75
78
|
I18n.stub(:locale).and_return("jp")
|
76
|
-
|
79
|
+
|
77
80
|
Time.stub(:zone).and_return(double('zone', :name => "EST"))
|
78
|
-
|
81
|
+
|
79
82
|
hash = {:one => 1, "two" => "here", "bus_id" => "app-given" }
|
80
83
|
event_name = "event_name"
|
81
|
-
|
82
|
-
val =
|
84
|
+
|
85
|
+
val = QueueBus.redis { |redis| redis.lpop("queue:bus_incoming") }
|
83
86
|
val.should == nil
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
val =
|
87
|
+
|
88
|
+
QueueBus.publish(event_name, hash)
|
89
|
+
|
90
|
+
val = QueueBus.redis { |redis| redis.lpop("queue:bus_incoming") }
|
88
91
|
hash = JSON.parse(val)
|
89
|
-
hash["class"].should == "
|
90
|
-
att = hash["args"].first
|
92
|
+
hash["class"].should == "QueueBus::Worker"
|
93
|
+
att = JSON.parse(hash["args"].first)
|
91
94
|
att["bus_locale"].should == "jp"
|
92
95
|
att["bus_timezone"].should == "EST"
|
93
96
|
end
|
data/spec/rider_spec.rb
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
module
|
3
|
+
module QueueBus
|
4
4
|
describe Rider do
|
5
5
|
it "should call execute" do
|
6
|
-
|
6
|
+
QueueBus.should_receive(:dispatcher_execute)
|
7
7
|
Rider.perform("bus_rider_app_key" => "app", "bus_rider_sub_key" => "sub", "ok" => true, "bus_event_type" => "event_name")
|
8
8
|
end
|
9
|
-
|
9
|
+
|
10
10
|
it "should change the value" do
|
11
|
-
|
11
|
+
QueueBus.dispatch("r1") do
|
12
12
|
subscribe "event_name" do |attributes|
|
13
13
|
Runner1.run(attributes)
|
14
14
|
end
|
@@ -18,74 +18,22 @@ module ResqueBus
|
|
18
18
|
Rider.perform("bus_rider_app_key" => "other", "bus_rider_sub_key" => "event_name", "ok" => true, "bus_event_type" => "event_name")
|
19
19
|
Runner1.value.should == 1
|
20
20
|
end
|
21
|
-
|
21
|
+
|
22
22
|
it "should set the timezone and locale if present" do
|
23
|
+
QueueBus.dispatch("r1") do
|
24
|
+
subscribe "event_name" do |attributes|
|
25
|
+
Runner1.run(attributes)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
23
29
|
defined?(I18n).should be_nil
|
24
|
-
Time.respond_to?(:zone).should
|
30
|
+
Time.respond_to?(:zone).should eq(false)
|
25
31
|
|
26
32
|
stub_const("I18n", Class.new)
|
27
33
|
I18n.should_receive(:locale=).with("en")
|
28
34
|
Time.should_receive(:zone=).with("PST")
|
29
|
-
|
35
|
+
|
30
36
|
Rider.perform("bus_locale" => "en", "bus_timezone" => "PST", "bus_rider_app_key" => "r1", "bus_rider_sub_key" => "event_name", "ok" => true, "bus_event_type" => "event_name")
|
31
37
|
end
|
32
|
-
|
33
|
-
context "Integration Test" do
|
34
|
-
before(:each) do
|
35
|
-
Resque.redis = "example.com/bad"
|
36
|
-
ResqueBus.original_redis = Resque.redis
|
37
|
-
ResqueBus.redis = "localhost:6379"
|
38
|
-
|
39
|
-
|
40
|
-
ResqueBus.enqueue_to("testing", "::ResqueBus::Rider", { "bus_rider_app_key" => "r2", "bus_rider_sub_key" => "event_name", "bus_event_type" => "event_name", "ok" => true, "bus_rider_queue" => "testing" })
|
41
|
-
|
42
|
-
# like the job does
|
43
|
-
Resque.redis = ResqueBus.redis
|
44
|
-
|
45
|
-
@worker = Resque::Worker.new(:testing)
|
46
|
-
@worker.register_worker
|
47
|
-
end
|
48
|
-
|
49
|
-
it "should use the app's redis within the rider" do
|
50
|
-
host = Resque.redis.instance_variable_get("@redis").instance_variable_get("@client").host
|
51
|
-
host.should == "localhost"
|
52
|
-
|
53
|
-
ResqueBus.dispatch("r2") do
|
54
|
-
subscribe "event_name" do |attributes|
|
55
|
-
host = Resque.redis.instance_variable_get("@redis").instance_variable_get("@client").host
|
56
|
-
if host == "example.com"
|
57
|
-
Runner1.run(attributes)
|
58
|
-
end
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
host = Resque.redis.instance_variable_get("@redis").instance_variable_get("@client").host
|
63
|
-
host.should == "localhost"
|
64
|
-
|
65
|
-
|
66
|
-
Runner1.value.should == 0
|
67
|
-
perform_next_job @worker
|
68
|
-
Runner1.value.should == 1
|
69
|
-
end
|
70
|
-
|
71
|
-
it "should put it in the failed jobs" do
|
72
|
-
|
73
|
-
ResqueBus.dispatch("r2") do
|
74
|
-
subscribe "event_name" do |attributes|
|
75
|
-
raise "boo!"
|
76
|
-
end
|
77
|
-
end
|
78
|
-
|
79
|
-
perform_next_job @worker
|
80
|
-
Resque.info[:processed].should == 1
|
81
|
-
Resque.info[:failed].should == 1
|
82
|
-
Resque.info[:pending].should == 1 # requeued
|
83
|
-
|
84
|
-
perform_next_job @worker
|
85
|
-
Resque.info[:processed].should == 2
|
86
|
-
Resque.info[:failed].should == 2
|
87
|
-
Resque.info[:pending].should == 0
|
88
|
-
end
|
89
|
-
end
|
90
38
|
end
|
91
|
-
end
|
39
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,49 +1,45 @@
|
|
1
1
|
require 'timecop'
|
2
|
-
require '
|
3
|
-
require '
|
2
|
+
require 'queue-bus'
|
3
|
+
require 'adapter/support'
|
4
4
|
|
5
|
-
|
5
|
+
reset_test_adapter
|
6
|
+
|
7
|
+
module QueueBus
|
6
8
|
class Runner
|
7
9
|
def self.value
|
8
10
|
@value ||= 0
|
9
11
|
end
|
10
|
-
|
12
|
+
|
11
13
|
def self.attributes
|
12
14
|
@attributes
|
13
15
|
end
|
14
|
-
|
16
|
+
|
15
17
|
def self.run(attrs)
|
16
18
|
@value ||= 0
|
17
19
|
@value += 1
|
18
20
|
@attributes = attrs
|
19
21
|
end
|
20
|
-
|
22
|
+
|
21
23
|
def self.reset
|
22
24
|
@value = nil
|
23
25
|
@attributes = nil
|
24
26
|
end
|
25
27
|
end
|
26
|
-
|
28
|
+
|
27
29
|
class Runner1 < Runner
|
28
30
|
end
|
29
|
-
|
31
|
+
|
30
32
|
class Runner2 < Runner
|
31
33
|
end
|
32
34
|
end
|
33
35
|
|
34
|
-
def perform_next_job(worker, &block)
|
35
|
-
return unless job = worker.reserve
|
36
|
-
worker.perform(job, &block)
|
37
|
-
worker.done_working
|
38
|
-
end
|
39
|
-
|
40
36
|
def test_sub(event_name, queue="default")
|
41
37
|
matcher = {"bus_event_type" => event_name}
|
42
|
-
|
38
|
+
QueueBus::Subscription.new(queue, event_name, "::QueueBus::Rider", matcher, nil)
|
43
39
|
end
|
44
40
|
|
45
41
|
def test_list(*args)
|
46
|
-
out =
|
42
|
+
out = QueueBus::SubscriptionList.new
|
47
43
|
args.each do |sub|
|
48
44
|
out.add(sub)
|
49
45
|
end
|
@@ -51,20 +47,24 @@ def test_list(*args)
|
|
51
47
|
end
|
52
48
|
|
53
49
|
RSpec.configure do |config|
|
54
|
-
config.
|
55
|
-
|
50
|
+
config.mock_with :rspec do |c|
|
51
|
+
c.syntax = :should
|
52
|
+
end
|
53
|
+
config.expect_with :rspec do |c|
|
54
|
+
c.syntax = :should
|
55
|
+
end
|
56
|
+
|
56
57
|
config.before(:each) do
|
57
|
-
|
58
|
+
reset_test_adapter
|
59
|
+
ResqueBus.show_deprecations = true
|
58
60
|
end
|
59
61
|
config.after(:each) do
|
60
62
|
begin
|
61
|
-
|
63
|
+
QueueBus.redis { |redis| redis.flushall }
|
62
64
|
rescue
|
63
65
|
end
|
64
|
-
|
65
|
-
|
66
|
-
|
66
|
+
QueueBus.send(:reset)
|
67
|
+
QueueBus::Runner1.reset
|
68
|
+
QueueBus::Runner2.reset
|
67
69
|
end
|
68
70
|
end
|
69
|
-
|
70
|
-
ResqueBus.redis.namespace = "resquebus_test"
|