sidekiq-bus 0.8.1 → 0.8.2

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.
@@ -1,83 +1,80 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  module QueueBus
4
6
  module Adapters
5
7
  class TestOne
6
-
7
8
  end
8
9
  end
9
10
  end
10
11
 
11
- describe "QueueBus config" do
12
- it "should set the default app key" do
12
+ describe 'QueueBus config' do
13
+ it 'should set the default app key' do
13
14
  expect(QueueBus.default_app_key).to eq(nil)
14
15
 
15
- QueueBus.default_app_key = "my_app"
16
- expect(QueueBus.default_app_key).to eq("my_app")
16
+ QueueBus.default_app_key = 'my_app'
17
+ expect(QueueBus.default_app_key).to eq('my_app')
17
18
 
18
- QueueBus.default_app_key = "something here"
19
- expect(QueueBus.default_app_key).to eq("something_here")
19
+ QueueBus.default_app_key = 'something here'
20
+ expect(QueueBus.default_app_key).to eq('something_here')
20
21
  end
21
22
 
22
- it "should set the default queue" do
23
+ it 'should set the default queue' do
23
24
  expect(QueueBus.default_queue).to eq(nil)
24
25
 
25
- QueueBus.default_queue = "my_queue"
26
- expect(QueueBus.default_queue).to eq("my_queue")
26
+ QueueBus.default_queue = 'my_queue'
27
+ expect(QueueBus.default_queue).to eq('my_queue')
27
28
  end
28
29
 
29
- it "should set the local mode" do
30
+ it 'should set the local mode' do
30
31
  expect(QueueBus.local_mode).to eq(nil)
31
32
  QueueBus.local_mode = :standalone
32
33
  expect(QueueBus.local_mode).to eq(:standalone)
33
34
  end
34
35
 
35
- it "should set the hostname" do
36
+ it 'should set the hostname' do
36
37
  expect(QueueBus.hostname).not_to eq(nil)
37
- QueueBus.hostname = "whatever"
38
- expect(QueueBus.hostname).to eq("whatever")
38
+ QueueBus.hostname = 'whatever'
39
+ expect(QueueBus.hostname).to eq('whatever')
39
40
  end
40
41
 
41
- it "should set before_publish callback" do
42
- QueueBus.before_publish = lambda {|attributes| 42 }
42
+ it 'should set before_publish callback' do
43
+ QueueBus.before_publish = ->(_attributes) { 42 }
43
44
  expect(QueueBus.before_publish_callback({})).to eq(42)
44
45
  end
45
46
 
46
-
47
- it "should use the default Redis connection" do
47
+ it 'should use the default Redis connection' do
48
48
  expect(QueueBus.redis { |redis| redis }).not_to eq(nil)
49
49
  end
50
50
 
51
- it "should default to given adapter" do
51
+ it 'should default to given adapter' do
52
52
  expect(QueueBus.adapter.is_a?(adapter_under_test_class)).to eq(true)
53
53
 
54
54
  # and should raise if already set
55
- expect {
55
+ expect do
56
56
  QueueBus.adapter = :data
57
- }.to raise_error("Adapter already set to QueueBus::Adapters::Sidekiq")
57
+ end.to raise_error('Adapter already set to QueueBus::Adapters::Sidekiq')
58
58
  end
59
59
 
60
- context "with a fresh load" do
60
+ context 'with a fresh load' do
61
61
  before(:each) do
62
62
  QueueBus.send(:reset)
63
63
  end
64
64
 
65
- it "should be able to be set to resque" do
65
+ it 'should be able to be set to resque' do
66
66
  QueueBus.adapter = adapter_under_test_symbol
67
67
  expect(QueueBus.adapter.is_a?(adapter_under_test_class)).to eq(true)
68
68
 
69
69
  # and should raise if already set
70
- expect {
70
+ expect do
71
71
  QueueBus.adapter = :data
72
- }.to raise_error("Adapter already set to QueueBus::Adapters::Sidekiq")
72
+ end.to raise_error('Adapter already set to QueueBus::Adapters::Sidekiq')
73
73
  end
74
74
 
75
- it "should be able to be set to something else" do
76
-
75
+ it 'should be able to be set to something else' do
77
76
  QueueBus.adapter = :test_one
78
77
  expect(QueueBus.adapter.is_a?(QueueBus::Adapters::TestOne)).to eq(true)
79
78
  end
80
79
  end
81
-
82
-
83
80
  end
@@ -1,72 +1,71 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  module QueueBus
4
6
  describe Dispatch do
5
- it "should not start with any applications" do
6
- expect(Dispatch.new("d").subscriptions.size).to eq(0)
7
+ it 'should not start with any applications' do
8
+ expect(Dispatch.new('d').subscriptions.size).to eq(0)
7
9
  end
8
10
 
9
- it "should register code to run and execute it" do
10
- dispatch = Dispatch.new("d")
11
- dispatch.subscribe("my_event") do |attrs|
11
+ it 'should register code to run and execute it' do
12
+ dispatch = Dispatch.new('d')
13
+ dispatch.subscribe('my_event') do |attrs|
12
14
  Runner1.run(attrs)
13
15
  end
14
- sub = dispatch.subscriptions.key("my_event")
16
+ sub = dispatch.subscriptions.key('my_event')
15
17
  expect(sub.send(:executor).is_a?(Proc)).to eq(true)
16
18
 
17
19
  expect(Runner.value).to eq(0)
18
- dispatch.execute("my_event", {"bus_event_type" => "my_event", "ok" => true})
20
+ dispatch.execute('my_event', 'bus_event_type' => 'my_event', 'ok' => true)
19
21
  expect(Runner1.value).to eq(1)
20
- expect(Runner1.attributes).to eq({"bus_event_type" => "my_event", "ok" => true})
22
+ expect(Runner1.attributes).to eq('bus_event_type' => 'my_event', 'ok' => true)
21
23
  end
22
24
 
23
- it "should not crash if not there" do
24
- expect(Dispatch.new("d").execute("fdkjh", "bus_event_type" => "fdkjh")).to eq(nil)
25
+ it 'should not crash if not there' do
26
+ expect(Dispatch.new('d').execute('fdkjh', 'bus_event_type' => 'fdkjh')).to eq(nil)
25
27
  end
26
28
 
27
- describe "Top Level" do
29
+ describe 'Top Level' do
28
30
  before(:each) do
29
- QueueBus.dispatch("testit") do
30
- subscribe "event1" do |attributes|
31
- Runner2.run(attributes)
32
- end
31
+ QueueBus.dispatch('testit') do
32
+ subscribe 'event1' do |attributes|
33
+ Runner2.run(attributes)
34
+ end
33
35
 
34
- subscribe "event2" do
35
- Runner2.run({})
36
- end
36
+ subscribe 'event2' do
37
+ Runner2.run({})
38
+ end
37
39
 
38
- high "event3" do
39
- Runner2.run({})
40
- end
40
+ high 'event3' do
41
+ Runner2.run({})
42
+ end
41
43
 
42
- low /^patt.+ern/ do
43
- Runner.run({})
44
- end
45
- end
46
- end
44
+ low /^patt.+ern/ do
45
+ Runner.run({})
46
+ end
47
+ end
48
+ end
47
49
 
48
- it "should register and run" do
50
+ it 'should register and run' do
49
51
  expect(Runner2.value).to eq(0)
50
- QueueBus.dispatcher_execute("testit", "event2", "bus_event_type" => "event2")
52
+ QueueBus.dispatcher_execute('testit', 'event2', 'bus_event_type' => 'event2')
51
53
  expect(Runner2.value).to eq(1)
52
- QueueBus.dispatcher_execute("testit", "event1", "bus_event_type" => "event1")
54
+ QueueBus.dispatcher_execute('testit', 'event1', 'bus_event_type' => 'event1')
53
55
  expect(Runner2.value).to eq(2)
54
- QueueBus.dispatcher_execute("testit", "event1", "bus_event_type" => "event1")
56
+ QueueBus.dispatcher_execute('testit', 'event1', 'bus_event_type' => 'event1')
55
57
  expect(Runner2.value).to eq(3)
56
58
  end
57
59
 
58
- it "should return the subscriptions" do
59
- dispatcher = QueueBus.dispatcher_by_key("testit")
60
+ it 'should return the subscriptions' do
61
+ dispatcher = QueueBus.dispatcher_by_key('testit')
60
62
  subs = dispatcher.subscriptions.all
61
- tuples = subs.collect{ |sub| [sub.key, sub.queue_name]}
62
- expect(tuples).to match_array([ ["event1", "testit_default"],
63
- ["event2", "testit_default"],
64
- ["event3", "testit_high"],
65
- [ "(?-mix:^patt.+ern)", "testit_low"]
66
- ])
63
+ tuples = subs.collect { |sub| [sub.key, sub.queue_name] }
64
+ expect(tuples).to match_array([%w[event1 testit_default],
65
+ %w[event2 testit_default],
66
+ %w[event3 testit_high],
67
+ ['(?-mix:^patt.+ern)', 'testit_low']])
67
68
  end
68
-
69
69
  end
70
70
  end
71
-
72
71
  end
@@ -1,92 +1,94 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  module QueueBus
4
6
  describe Driver do
5
7
  before(:each) do
6
- Application.new("app1").subscribe(test_list(test_sub("event1"), test_sub("event2"), test_sub("event3")))
7
- Application.new("app2").subscribe(test_list(test_sub("event2","other"), test_sub("event4", "more")))
8
- Application.new("app3").subscribe(test_list(test_sub("event[45]"), test_sub("event5"), test_sub("event6")))
8
+ Application.new('app1').subscribe(test_list(test_sub('event1'), test_sub('event2'), test_sub('event3')))
9
+ Application.new('app2').subscribe(test_list(test_sub('event2', 'other'), test_sub('event4', 'more')))
10
+ Application.new('app3').subscribe(test_list(test_sub('event[45]'), test_sub('event5'), test_sub('event6')))
9
11
  Timecop.freeze
10
12
  end
11
13
  after(:each) do
12
14
  Timecop.return
13
15
  end
14
16
 
15
- let(:bus_attrs) { {"bus_driven_at" => Time.now.to_i, "bus_rider_class_name"=>"::QueueBus::Rider", "bus_class_proxy" => "::QueueBus::Rider"} }
17
+ let(:bus_attrs) { { 'bus_driven_at' => Time.now.to_i, 'bus_rider_class_name' => '::QueueBus::Rider', 'bus_class_proxy' => '::QueueBus::Rider' } }
16
18
 
17
- describe ".subscription_matches" do
18
- it "return empty array when none" do
19
- expect(Driver.subscription_matches("bus_event_type" => "else").collect{|s| [s.app_key, s.key, s.queue_name, s.class_name]}).to eq([])
20
- expect(Driver.subscription_matches("bus_event_type" => "event").collect{|s| [s.app_key, s.key, s.queue_name, s.class_name]}).to eq([])
19
+ describe '.subscription_matches' do
20
+ it 'return empty array when none' do
21
+ expect(Driver.subscription_matches('bus_event_type' => 'else').collect { |s| [s.app_key, s.key, s.queue_name, s.class_name] }).to eq([])
22
+ expect(Driver.subscription_matches('bus_event_type' => 'event').collect { |s| [s.app_key, s.key, s.queue_name, s.class_name] }).to eq([])
21
23
  end
22
- it "should return a match" do
23
- expect(Driver.subscription_matches("bus_event_type" => "event1").collect{|s| [s.app_key, s.key, s.queue_name, s.class_name]}).to match_array([["app1", "event1", "default", "::QueueBus::Rider"]])
24
- expect(Driver.subscription_matches("bus_event_type" => "event6").collect{|s| [s.app_key, s.key, s.queue_name, s.class_name]}).to match_array([["app3", "event6", "default", "::QueueBus::Rider"]])
24
+ it 'should return a match' do
25
+ expect(Driver.subscription_matches('bus_event_type' => 'event1').collect { |s| [s.app_key, s.key, s.queue_name, s.class_name] }).to match_array([['app1', 'event1', 'default', '::QueueBus::Rider']])
26
+ expect(Driver.subscription_matches('bus_event_type' => 'event6').collect { |s| [s.app_key, s.key, s.queue_name, s.class_name] }).to match_array([['app3', 'event6', 'default', '::QueueBus::Rider']])
25
27
  end
26
- it "should match multiple apps" do
27
- expect(Driver.subscription_matches("bus_event_type" => "event2").collect{|s| [s.app_key, s.key, s.queue_name, s.class_name]}).to match_array([["app1", "event2", "default", "::QueueBus::Rider"], ["app2", "event2", "other", "::QueueBus::Rider"]])
28
+ it 'should match multiple apps' do
29
+ expect(Driver.subscription_matches('bus_event_type' => 'event2').collect { |s| [s.app_key, s.key, s.queue_name, s.class_name] }).to match_array([['app1', 'event2', 'default', '::QueueBus::Rider'], ['app2', 'event2', 'other', '::QueueBus::Rider']])
28
30
  end
29
- it "should match multiple apps with patterns" do
30
- expect(Driver.subscription_matches("bus_event_type" => "event4").collect{|s| [s.app_key, s.key, s.queue_name, s.class_name]}).to match_array([["app3", "event[45]", "default", "::QueueBus::Rider"], ["app2", "event4", "more", "::QueueBus::Rider"]])
31
+ it 'should match multiple apps with patterns' do
32
+ expect(Driver.subscription_matches('bus_event_type' => 'event4').collect { |s| [s.app_key, s.key, s.queue_name, s.class_name] }).to match_array([['app3', 'event[45]', 'default', '::QueueBus::Rider'], ['app2', 'event4', 'more', '::QueueBus::Rider']])
31
33
  end
32
- it "should match multiple events in same app" do
33
- expect(Driver.subscription_matches("bus_event_type" => "event5").collect{|s| [s.app_key, s.key, s.queue_name, s.class_name]}).to match_array([["app3", "event[45]", "default", "::QueueBus::Rider"], ["app3", "event5", "default", "::QueueBus::Rider"]])
34
+ it 'should match multiple events in same app' do
35
+ expect(Driver.subscription_matches('bus_event_type' => 'event5').collect { |s| [s.app_key, s.key, s.queue_name, s.class_name] }).to match_array([['app3', 'event[45]', 'default', '::QueueBus::Rider'], ['app3', 'event5', 'default', '::QueueBus::Rider']])
34
36
  end
35
37
  end
36
38
 
37
- describe ".perform" do
38
- let(:attributes) { {"x" => "y"} }
39
+ describe '.perform' do
40
+ let(:attributes) { { 'x' => 'y' } }
39
41
 
40
42
  before(:each) do
41
- expect(QueueBus.redis { |redis| redis.smembers("queues") }).to eq([])
42
- expect(QueueBus.redis { |redis| redis.lpop("queue:app1_default") }).to be_nil
43
- expect(QueueBus.redis { |redis| redis.lpop("queue:app2_default") }).to be_nil
44
- expect(QueueBus.redis { |redis| redis.lpop("queue:app3_default") }).to be_nil
43
+ expect(QueueBus.redis { |redis| redis.smembers('queues') }).to eq([])
44
+ expect(QueueBus.redis { |redis| redis.lpop('queue:app1_default') }).to be_nil
45
+ expect(QueueBus.redis { |redis| redis.lpop('queue:app2_default') }).to be_nil
46
+ expect(QueueBus.redis { |redis| redis.lpop('queue:app3_default') }).to be_nil
45
47
  end
46
48
 
47
- it "should do nothing when empty" do
48
- Driver.perform(attributes.merge("bus_event_type" => "else"))
49
- expect(QueueBus.redis { |redis| redis.smembers("queues") }).to eq([])
49
+ it 'should do nothing when empty' do
50
+ Driver.perform(attributes.merge('bus_event_type' => 'else'))
51
+ expect(QueueBus.redis { |redis| redis.smembers('queues') }).to eq([])
50
52
  end
51
53
 
52
- it "should queue up the riders in redis" do
53
- expect(QueueBus.redis { |redis| redis.lpop("queue:app1_default") }).to be_nil
54
- Driver.perform(attributes.merge("bus_event_type" => "event1"))
55
- expect(QueueBus.redis { |redis| redis.smembers("queues") }).to match_array(["default"])
54
+ it 'should queue up the riders in redis' do
55
+ expect(QueueBus.redis { |redis| redis.lpop('queue:app1_default') }).to be_nil
56
+ Driver.perform(attributes.merge('bus_event_type' => 'event1'))
57
+ expect(QueueBus.redis { |redis| redis.smembers('queues') }).to match_array(['default'])
56
58
 
57
- hash = JSON.parse(QueueBus.redis { |redis| redis.lpop("queue:default") })
58
- expect(hash["class"]).to eq("QueueBus::Worker")
59
- expect(hash["args"].size).to eq(1)
60
- expect(JSON.parse(hash["args"].first)).to eq({"bus_rider_app_key"=>"app1", "x" => "y", "bus_event_type" => "event1", "bus_rider_sub_key"=>"event1", "bus_rider_queue" => "default"}.merge(bus_attrs))
59
+ hash = JSON.parse(QueueBus.redis { |redis| redis.lpop('queue:default') })
60
+ expect(hash['class']).to eq('QueueBus::Worker')
61
+ expect(hash['args'].size).to eq(1)
62
+ expect(JSON.parse(hash['args'].first)).to eq({ 'bus_rider_app_key' => 'app1', 'x' => 'y', 'bus_event_type' => 'event1', 'bus_rider_sub_key' => 'event1', 'bus_rider_queue' => 'default' }.merge(bus_attrs))
61
63
  end
62
64
 
63
- it "should queue up to multiple" do
64
- Driver.perform(attributes.merge("bus_event_type" => "event4"))
65
- expect(QueueBus.redis { |redis| redis.smembers("queues") }).to match_array(["default", "more"])
65
+ it 'should queue up to multiple' do
66
+ Driver.perform(attributes.merge('bus_event_type' => 'event4'))
67
+ expect(QueueBus.redis { |redis| redis.smembers('queues') }).to match_array(%w[default more])
66
68
 
67
- hash = JSON.parse(QueueBus.redis { |redis| redis.lpop("queue:more") })
68
- expect(hash["class"]).to eq("QueueBus::Worker")
69
- expect(hash["args"].size).to eq(1)
70
- expect(JSON.parse(hash["args"].first)).to eq({"bus_rider_app_key"=>"app2", "x" => "y", "bus_event_type" => "event4", "bus_rider_sub_key"=>"event4", "bus_rider_queue" => "more"}.merge(bus_attrs))
69
+ hash = JSON.parse(QueueBus.redis { |redis| redis.lpop('queue:more') })
70
+ expect(hash['class']).to eq('QueueBus::Worker')
71
+ expect(hash['args'].size).to eq(1)
72
+ expect(JSON.parse(hash['args'].first)).to eq({ 'bus_rider_app_key' => 'app2', 'x' => 'y', 'bus_event_type' => 'event4', 'bus_rider_sub_key' => 'event4', 'bus_rider_queue' => 'more' }.merge(bus_attrs))
71
73
 
72
- hash = JSON.parse(QueueBus.redis { |redis| redis.lpop("queue:default") })
73
- expect(hash["class"]).to eq("QueueBus::Worker")
74
- expect(hash["args"].size).to eq(1)
75
- expect(JSON.parse(hash["args"].first)).to eq({"bus_rider_app_key"=>"app3", "x" => "y", "bus_event_type" => "event4", "bus_rider_sub_key"=>"event[45]", "bus_rider_queue" => "default"}.merge(bus_attrs))
74
+ hash = JSON.parse(QueueBus.redis { |redis| redis.lpop('queue:default') })
75
+ expect(hash['class']).to eq('QueueBus::Worker')
76
+ expect(hash['args'].size).to eq(1)
77
+ expect(JSON.parse(hash['args'].first)).to eq({ 'bus_rider_app_key' => 'app3', 'x' => 'y', 'bus_event_type' => 'event4', 'bus_rider_sub_key' => 'event[45]', 'bus_rider_queue' => 'default' }.merge(bus_attrs))
76
78
  end
77
79
 
78
- it "should queue up to the same" do
79
- Driver.perform(attributes.merge("bus_event_type" => "event5"))
80
- expect(QueueBus.redis { |redis| redis.smembers("queues") }).to match_array(["default"])
80
+ it 'should queue up to the same' do
81
+ Driver.perform(attributes.merge('bus_event_type' => 'event5'))
82
+ expect(QueueBus.redis { |redis| redis.smembers('queues') }).to match_array(['default'])
81
83
 
82
- expect(QueueBus.redis { |redis| redis.llen("queue:default") }).to eq(2)
84
+ expect(QueueBus.redis { |redis| redis.llen('queue:default') }).to eq(2)
83
85
 
84
- pop1 = JSON.parse(QueueBus.redis { |redis| redis.lpop("queue:default") })
85
- pop2 = JSON.parse(QueueBus.redis { |redis| redis.lpop("queue:default") })
86
+ pop1 = JSON.parse(QueueBus.redis { |redis| redis.lpop('queue:default') })
87
+ pop2 = JSON.parse(QueueBus.redis { |redis| redis.lpop('queue:default') })
86
88
 
87
- pargs1 = JSON.parse(pop1["args"].first)
88
- pargs2 = JSON.parse(pop2["args"].first)
89
- if pargs1["bus_rider_sub_key"] == "event5"
89
+ pargs1 = JSON.parse(pop1['args'].first)
90
+ pargs2 = JSON.parse(pop2['args'].first)
91
+ if pargs1['bus_rider_sub_key'] == 'event5'
90
92
  hash1 = pop1
91
93
  hash2 = pop2
92
94
  args1 = pargs1
@@ -98,11 +100,11 @@ module QueueBus
98
100
  args2 = pargs1
99
101
  end
100
102
 
101
- expect(hash1["class"]).to eq("QueueBus::Worker")
102
- expect(args1).to eq({"bus_rider_app_key"=>"app3", "x" => "y", "bus_event_type" => "event5", "bus_rider_sub_key"=>"event5", "bus_rider_queue" => "default"}.merge(bus_attrs))
103
+ expect(hash1['class']).to eq('QueueBus::Worker')
104
+ expect(args1).to eq({ 'bus_rider_app_key' => 'app3', 'x' => 'y', 'bus_event_type' => 'event5', 'bus_rider_sub_key' => 'event5', 'bus_rider_queue' => 'default' }.merge(bus_attrs))
103
105
 
104
- expect(hash2["class"]).to eq("QueueBus::Worker")
105
- expect(args2).to eq({"bus_rider_app_key"=>"app3", "x" => "y", "bus_event_type" => "event5", "bus_rider_sub_key"=>"event[45]", "bus_rider_queue" => "default"}.merge(bus_attrs))
106
+ expect(hash2['class']).to eq('QueueBus::Worker')
107
+ expect(args2).to eq({ 'bus_rider_app_key' => 'app3', 'x' => 'y', 'bus_event_type' => 'event5', 'bus_rider_sub_key' => 'event[45]', 'bus_rider_queue' => 'default' }.merge(bus_attrs))
106
108
  end
107
109
  end
108
110
  end
@@ -1,42 +1,44 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  module QueueBus
4
6
  describe Heartbeat do
5
7
  def now_attributes
6
8
  {
7
- "epoch_seconds" => (Time.now.to_i / 60) * 60, # rounded
8
- "epoch_minutes" => Time.now.to_i / 60,
9
- "epoch_hours" => Time.now.to_i / (60*60),
10
- "epoch_days" => Time.now.to_i / (60*60*24),
11
- "minute" => Time.now.min,
12
- "hour" => Time.now.hour,
13
- "day" => Time.now.day,
14
- "month" => Time.now.month,
15
- "year" => Time.now.year,
16
- "yday" => Time.now.yday,
17
- "wday" => Time.now.wday
9
+ 'epoch_seconds' => (Time.now.to_i / 60) * 60, # rounded
10
+ 'epoch_minutes' => Time.now.to_i / 60,
11
+ 'epoch_hours' => Time.now.to_i / (60 * 60),
12
+ 'epoch_days' => Time.now.to_i / (60 * 60 * 24),
13
+ 'minute' => Time.now.min,
14
+ 'hour' => Time.now.hour,
15
+ 'day' => Time.now.day,
16
+ 'month' => Time.now.month,
17
+ 'year' => Time.now.year,
18
+ 'yday' => Time.now.yday,
19
+ 'wday' => Time.now.wday
18
20
  }
19
21
  end
20
-
21
- it "should publish the current time once" do
22
- Timecop.freeze "12/12/2013 12:01:19" do
23
- expect(QueueBus).to receive(:publish).with("heartbeat_minutes", now_attributes)
22
+
23
+ it 'should publish the current time once' do
24
+ Timecop.freeze '12/12/2013 12:01:19' do
25
+ expect(QueueBus).to receive(:publish).with('heartbeat_minutes', now_attributes)
24
26
  Heartbeat.perform
25
27
  end
26
-
27
- Timecop.freeze "12/12/2013 12:01:40" do
28
+
29
+ Timecop.freeze '12/12/2013 12:01:40' do
28
30
  Heartbeat.perform
29
31
  end
30
32
  end
31
-
32
- it "should publish a minute later" do
33
- Timecop.freeze "12/12/2013 12:01:19" do
34
- expect(QueueBus).to receive(:publish).with("heartbeat_minutes", now_attributes)
33
+
34
+ it 'should publish a minute later' do
35
+ Timecop.freeze '12/12/2013 12:01:19' do
36
+ expect(QueueBus).to receive(:publish).with('heartbeat_minutes', now_attributes)
35
37
  Heartbeat.perform
36
38
  end
37
-
38
- Timecop.freeze "12/12/2013 12:02:01" do
39
- expect(QueueBus).to receive(:publish).with("heartbeat_minutes", now_attributes)
39
+
40
+ Timecop.freeze '12/12/2013 12:02:01' do
41
+ expect(QueueBus).to receive(:publish).with('heartbeat_minutes', now_attributes)
40
42
  Heartbeat.perform
41
43
  end
42
44
  end