rpush 2.3.1-java → 2.3.2-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (66) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +6 -0
  3. data/README.md +36 -28
  4. data/lib/rpush/configuration.rb +1 -0
  5. data/lib/rpush/daemon/feeder.rb +16 -12
  6. data/lib/rpush/daemon/interruptible_sleep.rb +26 -5
  7. data/lib/rpush/daemon/store/active_record.rb +4 -0
  8. data/lib/rpush/daemon/store/interface.rb +1 -1
  9. data/lib/rpush/daemon/store/redis.rb +10 -0
  10. data/lib/rpush/embed.rb +1 -0
  11. data/lib/rpush/logger.rb +1 -0
  12. data/lib/rpush/push.rb +1 -2
  13. data/lib/rpush/version.rb +1 -1
  14. data/spec/functional/adm_spec.rb +6 -8
  15. data/spec/functional/apns_spec.rb +9 -9
  16. data/spec/functional/embed_spec.rb +3 -3
  17. data/spec/functional/gcm_spec.rb +6 -8
  18. data/spec/functional/new_app_spec.rb +5 -20
  19. data/spec/functional/retry_spec.rb +8 -12
  20. data/spec/functional/synchronization_spec.rb +1 -1
  21. data/spec/functional/wpns_spec.rb +7 -7
  22. data/spec/functional_spec_helper.rb +4 -5
  23. data/spec/spec_helper.rb +1 -1
  24. data/spec/unit/apns_feedback_spec.rb +4 -4
  25. data/spec/unit/client/active_record/adm/app_spec.rb +12 -12
  26. data/spec/unit/client/active_record/adm/notification_spec.rb +9 -9
  27. data/spec/unit/client/active_record/apns/app_spec.rb +4 -4
  28. data/spec/unit/client/active_record/apns/feedback_spec.rb +2 -2
  29. data/spec/unit/client/active_record/apns/notification_spec.rb +46 -46
  30. data/spec/unit/client/active_record/app_spec.rb +6 -6
  31. data/spec/unit/client/active_record/gcm/notification_spec.rb +7 -7
  32. data/spec/unit/client/active_record/notification_spec.rb +2 -2
  33. data/spec/unit/client/active_record/wpns/notification_spec.rb +2 -8
  34. data/spec/unit/configuration_spec.rb +5 -5
  35. data/spec/unit/daemon/adm/delivery_spec.rb +69 -69
  36. data/spec/unit/daemon/apns/delivery_spec.rb +13 -13
  37. data/spec/unit/daemon/apns/feedback_receiver_spec.rb +24 -26
  38. data/spec/unit/daemon/app_runner_spec.rb +29 -29
  39. data/spec/unit/daemon/batch_spec.rb +30 -30
  40. data/spec/unit/daemon/delivery_error_spec.rb +2 -2
  41. data/spec/unit/daemon/delivery_spec.rb +6 -6
  42. data/spec/unit/daemon/dispatcher/http_spec.rb +5 -5
  43. data/spec/unit/daemon/dispatcher/tcp_spec.rb +4 -4
  44. data/spec/unit/daemon/dispatcher_loop_spec.rb +9 -9
  45. data/spec/unit/daemon/feeder_spec.rb +22 -23
  46. data/spec/unit/daemon/gcm/delivery_spec.rb +56 -56
  47. data/spec/unit/daemon/retryable_error_spec.rb +2 -2
  48. data/spec/unit/daemon/service_config_methods_spec.rb +5 -5
  49. data/spec/unit/daemon/signal_handler_spec.rb +13 -13
  50. data/spec/unit/daemon/store/active_record/reconnectable_spec.rb +13 -13
  51. data/spec/unit/daemon/store/active_record_spec.rb +49 -49
  52. data/spec/unit/daemon/tcp_connection_spec.rb +50 -50
  53. data/spec/unit/daemon/wpns/delivery_spec.rb +36 -36
  54. data/spec/unit/daemon_spec.rb +33 -30
  55. data/spec/unit/deprecatable_spec.rb +3 -3
  56. data/spec/unit/deprecation_spec.rb +2 -2
  57. data/spec/unit/embed_spec.rb +7 -7
  58. data/spec/unit/logger_spec.rb +25 -25
  59. data/spec/unit/notification_shared.rb +7 -7
  60. data/spec/unit/plugin_spec.rb +1 -1
  61. data/spec/unit/push_spec.rb +8 -8
  62. data/spec/unit/reflectable_spec.rb +5 -5
  63. data/spec/unit/reflection_collection_spec.rb +2 -2
  64. data/spec/unit/rpush_spec.rb +1 -1
  65. data/spec/unit_spec_helper.rb +4 -5
  66. metadata +10 -4
@@ -5,10 +5,10 @@ describe Rpush::RetryableError do
5
5
  let(:error) { Rpush::RetryableError.new(401, 12, "Unauthorized", response) }
6
6
 
7
7
  it "returns an informative message" do
8
- error.to_s.should eq "Retryable error for 12, received error 401 (Unauthorized) - retry after 3600"
8
+ expect(error.to_s).to eq "Retryable error for 12, received error 401 (Unauthorized) - retry after 3600"
9
9
  end
10
10
 
11
11
  it "returns the error code" do
12
- error.code.should eq 401
12
+ expect(error.code).to eq 401
13
13
  end
14
14
  end
@@ -7,24 +7,24 @@ describe Rpush::Daemon::ServiceConfigMethods do
7
7
  end
8
8
 
9
9
  it 'returns the delivery class' do
10
- ServiceConfigMethodsSpec.delivery_class.should eq ServiceConfigMethodsSpec::Delivery
10
+ expect(ServiceConfigMethodsSpec.delivery_class).to eq ServiceConfigMethodsSpec::Delivery
11
11
  end
12
12
 
13
13
  it 'instantiates loops' do
14
14
  loop_class = Class.new
15
15
  app = double
16
16
  loop_instance = loop_class.new
17
- loop_class.should_receive(:new).with(app).and_return(loop_instance)
17
+ expect(loop_class).to receive(:new).with(app).and_return(loop_instance)
18
18
  ServiceConfigMethodsSpec.loops loop_class
19
- ServiceConfigMethodsSpec.loop_instances(app).should eq [loop_instance]
19
+ expect(ServiceConfigMethodsSpec.loop_instances(app)).to eq [loop_instance]
20
20
  end
21
21
 
22
22
  it 'returns a new dispatcher' do
23
23
  ServiceConfigMethodsSpec.dispatcher :http, an: :option
24
24
  app = double
25
25
  dispatcher = double
26
- Rpush::Daemon::Dispatcher::Http.should_receive(:new).with(app, ServiceConfigMethodsSpec::Delivery, an: :option).and_return(dispatcher)
27
- ServiceConfigMethodsSpec.new_dispatcher(app).should eq dispatcher
26
+ expect(Rpush::Daemon::Dispatcher::Http).to receive(:new).with(app, ServiceConfigMethodsSpec::Delivery, an: :option).and_return(dispatcher)
27
+ expect(ServiceConfigMethodsSpec.new_dispatcher(app)).to eq dispatcher
28
28
  end
29
29
 
30
30
  it 'raises a NotImplementedError for an unknown dispatcher type' do
@@ -17,14 +17,14 @@ describe Rpush::Daemon::SignalHandler do
17
17
  unless Rpush.jruby? # These tests do not work on JRuby.
18
18
  it "shuts down when signaled signaled SIGINT" do
19
19
  with_handler_start_stop do
20
- Rpush::Daemon.should_receive(:shutdown)
20
+ expect(Rpush::Daemon).to receive(:shutdown)
21
21
  signal_handler('SIGINT')
22
22
  end
23
23
  end
24
24
 
25
25
  it "shuts down when signaled signaled SIGTERM" do
26
26
  with_handler_start_stop do
27
- Rpush::Daemon.should_receive(:shutdown)
27
+ expect(Rpush::Daemon).to receive(:shutdown)
28
28
  signal_handler('SIGTERM')
29
29
  end
30
30
  end
@@ -35,28 +35,28 @@ describe Rpush::Daemon::SignalHandler do
35
35
  before { Rpush.config.embedded = true }
36
36
 
37
37
  it 'does not trap signals' do
38
- Signal.should_not_receive(:trap)
38
+ expect(Signal).not_to receive(:trap)
39
39
  Rpush::Daemon::SignalHandler.start
40
40
  end
41
41
  end
42
42
 
43
43
  describe 'HUP' do
44
44
  before do
45
- Rpush::Daemon::Synchronizer.stub(:sync)
46
- Rpush::Daemon::Feeder.stub(:wakeup)
47
- Rpush::Daemon.stub(store: double(reopen_log: nil))
45
+ allow(Rpush::Daemon::Synchronizer).to receive(:sync)
46
+ allow(Rpush::Daemon::Feeder).to receive(:wakeup)
47
+ allow(Rpush::Daemon).to receive_messages(store: double(reopen_log: nil))
48
48
  end
49
49
 
50
50
  it 'syncs' do
51
51
  with_handler_start_stop do
52
- Rpush::Daemon::Synchronizer.should_receive(:sync)
52
+ expect(Rpush::Daemon::Synchronizer).to receive(:sync)
53
53
  signal_handler('HUP')
54
54
  end
55
55
  end
56
56
 
57
57
  it 'wakes up the Feeder' do
58
58
  with_handler_start_stop do
59
- Rpush::Daemon::Feeder.should_receive(:wakeup)
59
+ expect(Rpush::Daemon::Feeder).to receive(:wakeup)
60
60
  signal_handler('HUP')
61
61
  end
62
62
  end
@@ -65,7 +65,7 @@ describe Rpush::Daemon::SignalHandler do
65
65
  describe 'USR2' do
66
66
  it 'instructs the AppRunner to print debug information' do
67
67
  with_handler_start_stop do
68
- Rpush::Daemon::AppRunner.should_receive(:debug)
68
+ expect(Rpush::Daemon::AppRunner).to receive(:debug)
69
69
  signal_handler('USR2')
70
70
  end
71
71
  end
@@ -75,12 +75,12 @@ describe Rpush::Daemon::SignalHandler do
75
75
  let(:error) { StandardError.new('test') }
76
76
 
77
77
  before do
78
- Rpush.stub(logger: double(error: nil, info: nil, reopen: nil))
79
- Rpush::Daemon.stub(store: double(reopen_log: nil))
78
+ allow(Rpush).to receive_messages(logger: double(error: nil, info: nil, reopen: nil))
79
+ allow(Rpush::Daemon).to receive_messages(store: double(reopen_log: nil))
80
80
  end
81
81
 
82
82
  it 'logs errors received when handling a signal' do
83
- Rpush::Daemon::Synchronizer.stub(:sync).and_raise(error)
83
+ allow(Rpush::Daemon::Synchronizer).to receive(:sync).and_raise(error)
84
84
  expect(Rpush.logger).to receive(:error).with(error)
85
85
  with_handler_start_stop do
86
86
  signal_handler('HUP')
@@ -88,7 +88,7 @@ describe Rpush::Daemon::SignalHandler do
88
88
  end
89
89
 
90
90
  it 'does not interrupt processing of further errors' do
91
- Rpush::Daemon::Synchronizer.stub(:sync).and_raise(error)
91
+ allow(Rpush::Daemon::Synchronizer).to receive(:sync).and_raise(error)
92
92
  expect(Rpush::Daemon::AppRunner).to receive(:debug)
93
93
  with_handler_start_stop do
94
94
  signal_handler('HUP')
@@ -48,40 +48,40 @@ describe Rpush::Daemon::Store::ActiveRecord::Reconnectable do
48
48
 
49
49
  before do
50
50
  @logger = double("Logger", info: nil, error: nil, warn: nil)
51
- Rpush.stub(:logger).and_return(@logger)
51
+ allow(Rpush).to receive(:logger).and_return(@logger)
52
52
 
53
- ActiveRecord::Base.stub(:clear_all_connections!)
54
- ActiveRecord::Base.stub(:establish_connection)
53
+ allow(ActiveRecord::Base).to receive(:clear_all_connections!)
54
+ allow(ActiveRecord::Base).to receive(:establish_connection)
55
55
  test_doubles.each { |td| allow(td).to receive(:sleep) }
56
56
  end
57
57
 
58
58
  it "should log the error raised" do
59
- Rpush.logger.should_receive(:error).with(error)
59
+ expect(Rpush.logger).to receive(:error).with(error)
60
60
  test_doubles.each(&:perform)
61
61
  end
62
62
 
63
63
  it "should log that the database is being reconnected" do
64
- Rpush.logger.should_receive(:warn).with("Lost connection to database, reconnecting...")
64
+ expect(Rpush.logger).to receive(:warn).with("Lost connection to database, reconnecting...")
65
65
  test_doubles.each(&:perform)
66
66
  end
67
67
 
68
68
  it "should log the reconnection attempt" do
69
- Rpush.logger.should_receive(:warn).with("Attempt 1")
69
+ expect(Rpush.logger).to receive(:warn).with("Attempt 1")
70
70
  test_doubles.each(&:perform)
71
71
  end
72
72
 
73
73
  it "should clear all connections" do
74
- ActiveRecord::Base.should_receive(:clear_all_connections!)
74
+ expect(ActiveRecord::Base).to receive(:clear_all_connections!)
75
75
  test_doubles.each(&:perform)
76
76
  end
77
77
 
78
78
  it "should establish a new connection" do
79
- ActiveRecord::Base.should_receive(:establish_connection)
79
+ expect(ActiveRecord::Base).to receive(:establish_connection)
80
80
  test_doubles.each(&:perform)
81
81
  end
82
82
 
83
83
  it "should test out the new connection by performing a count" do
84
- Rpush::Client::ActiveRecord::Notification.should_receive(:count).twice
84
+ expect(Rpush::Client::ActiveRecord::Notification).to receive(:count).twice
85
85
  test_doubles.each(&:perform)
86
86
  end
87
87
 
@@ -100,12 +100,12 @@ describe Rpush::Daemon::Store::ActiveRecord::Reconnectable do
100
100
 
101
101
  describe "error behaviour" do
102
102
  it "should log the 2nd attempt" do
103
- Rpush.logger.should_receive(:warn).with("Attempt 2")
103
+ expect(Rpush.logger).to receive(:warn).with("Attempt 2")
104
104
  test_doubles[0].perform
105
105
  end
106
106
 
107
107
  it "should log errors raised when the reconnection is not successful" do
108
- Rpush.logger.should_receive(:error).with(error)
108
+ expect(Rpush.logger).to receive(:error).with(error)
109
109
  test_doubles[0].perform
110
110
  end
111
111
 
@@ -117,12 +117,12 @@ describe Rpush::Daemon::Store::ActiveRecord::Reconnectable do
117
117
 
118
118
  describe "timeout behaviour" do
119
119
  it "should log the 2nd attempt" do
120
- Rpush.logger.should_receive(:warn).with("Attempt 2")
120
+ expect(Rpush.logger).to receive(:warn).with("Attempt 2")
121
121
  test_doubles[1].perform
122
122
  end
123
123
 
124
124
  it "should log errors raised when the reconnection is not successful" do
125
- Rpush.logger.should_receive(:error).with(error)
125
+ expect(Rpush.logger).to receive(:error).with(error)
126
126
  test_doubles[1].perform
127
127
  end
128
128
 
@@ -9,35 +9,35 @@ describe Rpush::Daemon::Store::ActiveRecord do
9
9
  let(:logger) { double(Rpush::Logger, error: nil, internal_logger: nil) }
10
10
 
11
11
  before do
12
- Rpush.stub(logger: logger)
13
- Time.stub(now: time)
12
+ allow(Rpush).to receive_messages(logger: logger)
13
+ allow(Time).to receive_messages(now: time)
14
14
  end
15
15
 
16
16
  it 'can update a notification' do
17
- notification.should_receive(:save!)
17
+ expect(notification).to receive(:save!)
18
18
  store.update_notification(notification)
19
19
  end
20
20
 
21
21
  it 'can update a app' do
22
- app.should_receive(:save!)
22
+ expect(app).to receive(:save!)
23
23
  store.update_app(app)
24
24
  end
25
25
 
26
26
  it 'can release a connection' do
27
- ActiveRecord::Base.connection.should_receive(:close)
27
+ expect(ActiveRecord::Base.connection).to receive(:close)
28
28
  store.release_connection
29
29
  end
30
30
 
31
31
  it 'logs errors raised when trying to release the connection' do
32
32
  e = StandardError.new
33
- ActiveRecord::Base.connection.stub(:close).and_raise(e)
34
- Rpush.logger.should_receive(:error).with(e)
33
+ allow(ActiveRecord::Base.connection).to receive(:close).and_raise(e)
34
+ expect(Rpush.logger).to receive(:error).with(e)
35
35
  store.release_connection
36
36
  end
37
37
 
38
38
  describe 'deliverable_notifications' do
39
39
  it 'checks for new notifications with the ability to reconnect the database' do
40
- store.should_receive(:with_database_reconnect_and_retry)
40
+ expect(store).to receive(:with_database_reconnect_and_retry)
41
41
  store.deliverable_notifications(Rpush.config.batch_size)
42
42
  end
43
43
 
@@ -45,43 +45,43 @@ describe Rpush::Daemon::Store::ActiveRecord do
45
45
  Rpush.config.batch_size = 5000
46
46
  Rpush.config.push = false
47
47
  relation = double.as_null_object
48
- relation.should_receive(:limit).with(5000)
49
- relation.stub(to_a: [])
50
- store.stub(ready_for_delivery: relation)
48
+ expect(relation).to receive(:limit).with(5000)
49
+ allow(relation).to receive_messages(to_a: [])
50
+ allow(store).to receive_messages(ready_for_delivery: relation)
51
51
  store.deliverable_notifications(Rpush.config.batch_size)
52
52
  end
53
53
 
54
54
  it 'does not load notification in batches if in push mode' do
55
55
  Rpush.config.push = true
56
56
  relation = double.as_null_object
57
- relation.should_not_receive(:limit)
58
- Rpush::Notification.stub(ready_for_delivery: relation)
57
+ expect(relation).not_to receive(:limit)
58
+ allow(Rpush::Notification).to receive_messages(ready_for_delivery: relation)
59
59
  store.deliverable_notifications(Rpush.config.batch_size)
60
60
  end
61
61
 
62
62
  it 'loads an undelivered notification without deliver_after set' do
63
63
  notification.update_attributes!(delivered: false, deliver_after: nil)
64
- store.deliverable_notifications(Rpush.config.batch_size).should eq [notification]
64
+ expect(store.deliverable_notifications(Rpush.config.batch_size)).to eq [notification]
65
65
  end
66
66
 
67
67
  it 'loads an notification with a deliver_after time in the past' do
68
68
  notification.update_attributes!(delivered: false, deliver_after: 1.hour.ago)
69
- store.deliverable_notifications(Rpush.config.batch_size).should eq [notification]
69
+ expect(store.deliverable_notifications(Rpush.config.batch_size)).to eq [notification]
70
70
  end
71
71
 
72
72
  it 'does not load an notification with a deliver_after time in the future' do
73
73
  notification.update_attributes!(delivered: false, deliver_after: 1.hour.from_now)
74
- store.deliverable_notifications(Rpush.config.batch_size).should be_empty
74
+ expect(store.deliverable_notifications(Rpush.config.batch_size)).to be_empty
75
75
  end
76
76
 
77
77
  it 'does not load a previously delivered notification' do
78
78
  notification.update_attributes!(delivered: true, delivered_at: time)
79
- store.deliverable_notifications(Rpush.config.batch_size).should be_empty
79
+ expect(store.deliverable_notifications(Rpush.config.batch_size)).to be_empty
80
80
  end
81
81
 
82
82
  it "does not enqueue a notification that has previously failed delivery" do
83
83
  notification.update_attributes!(delivered: false, failed: true)
84
- store.deliverable_notifications(Rpush.config.batch_size).should be_empty
84
+ expect(store.deliverable_notifications(Rpush.config.batch_size)).to be_empty
85
85
  end
86
86
  end
87
87
 
@@ -100,12 +100,12 @@ describe Rpush::Daemon::Store::ActiveRecord do
100
100
  end
101
101
 
102
102
  it 'saves the notification without validation' do
103
- notification.should_receive(:save!).with(validate: false)
103
+ expect(notification).to receive(:save!).with(validate: false)
104
104
  store.mark_retryable(notification, time)
105
105
  end
106
106
 
107
107
  it 'does not save the notification if persist: false' do
108
- notification.should_not_receive(:save!)
108
+ expect(notification).not_to receive(:save!)
109
109
  store.mark_retryable(notification, time, persist: false)
110
110
  end
111
111
  end
@@ -115,8 +115,8 @@ describe Rpush::Daemon::Store::ActiveRecord do
115
115
 
116
116
  it 'sets the attributes on the object for use in reflections' do
117
117
  store.mark_batch_retryable([notification], deliver_after)
118
- notification.deliver_after.should eq deliver_after
119
- notification.retries.should eq 1
118
+ expect(notification.deliver_after).to eq deliver_after
119
+ expect(notification.retries).to eq 1
120
120
  end
121
121
 
122
122
  it 'increments the retired count' do
@@ -149,12 +149,12 @@ describe Rpush::Daemon::Store::ActiveRecord do
149
149
  end
150
150
 
151
151
  it 'saves the notification without validation' do
152
- notification.should_receive(:save!).with(validate: false)
152
+ expect(notification).to receive(:save!).with(validate: false)
153
153
  store.mark_delivered(notification, time)
154
154
  end
155
155
 
156
156
  it 'does not save the notification if persist: false' do
157
- notification.should_not_receive(:save!)
157
+ expect(notification).not_to receive(:save!)
158
158
  store.mark_delivered(notification, time, persist: false)
159
159
  end
160
160
  end
@@ -162,8 +162,8 @@ describe Rpush::Daemon::Store::ActiveRecord do
162
162
  describe 'mark_batch_delivered' do
163
163
  it 'sets the attributes on the object for use in reflections' do
164
164
  store.mark_batch_delivered([notification])
165
- notification.delivered_at.should eq time
166
- notification.delivered.should be_true
165
+ expect(notification.delivered_at).to eq time
166
+ expect(notification.delivered).to be_truthy
167
167
  end
168
168
 
169
169
  it 'marks the notifications as delivered' do
@@ -184,7 +184,7 @@ describe Rpush::Daemon::Store::ActiveRecord do
184
184
  describe 'mark_failed' do
185
185
  it 'marks the notification as not delivered' do
186
186
  store.mark_failed(notification, nil, '', time)
187
- notification.delivered.should be_false
187
+ expect(notification.delivered).to eq(false)
188
188
  end
189
189
 
190
190
  it 'marks the notification as failed' do
@@ -214,12 +214,12 @@ describe Rpush::Daemon::Store::ActiveRecord do
214
214
  end
215
215
 
216
216
  it 'saves the notification without validation' do
217
- notification.should_receive(:save!).with(validate: false)
217
+ expect(notification).to receive(:save!).with(validate: false)
218
218
  store.mark_failed(notification, nil, '', time)
219
219
  end
220
220
 
221
221
  it 'does not save the notification if persist: false' do
222
- notification.should_not_receive(:save!)
222
+ expect(notification).not_to receive(:save!)
223
223
  store.mark_failed(notification, nil, '', time, persist: false)
224
224
  end
225
225
  end
@@ -227,18 +227,18 @@ describe Rpush::Daemon::Store::ActiveRecord do
227
227
  describe 'mark_batch_failed' do
228
228
  it 'sets the attributes on the object for use in reflections' do
229
229
  store.mark_batch_failed([notification], 123, 'an error')
230
- notification.failed_at.should eq time
231
- notification.delivered_at.should be_nil
232
- notification.delivered.should be_false
233
- notification.failed.should be_true
234
- notification.error_code.should eq 123
235
- notification.error_description.should eq 'an error'
230
+ expect(notification.failed_at).to eq time
231
+ expect(notification.delivered_at).to be_nil
232
+ expect(notification.delivered).to eq(false)
233
+ expect(notification.failed).to be_truthy
234
+ expect(notification.error_code).to eq 123
235
+ expect(notification.error_description).to eq 'an error'
236
236
  end
237
237
 
238
238
  it 'marks the notification as not delivered' do
239
239
  store.mark_batch_failed([notification], nil, '')
240
240
  notification.reload
241
- notification.delivered.should be_false
241
+ expect(notification.delivered).to be_falsey
242
242
  end
243
243
 
244
244
  it 'marks the notification as failed' do
@@ -272,7 +272,7 @@ describe Rpush::Daemon::Store::ActiveRecord do
272
272
 
273
273
  describe 'create_apns_feedback' do
274
274
  it 'creates the Feedback record' do
275
- Rpush::Client::ActiveRecord::Apns::Feedback.should_receive(:create!).with(
275
+ expect(Rpush::Client::ActiveRecord::Apns::Feedback).to receive(:create!).with(
276
276
  failed_at: time, device_token: 'ab' * 32, app_id: app.id)
277
277
  store.create_apns_feedback(time, 'ab' * 32, app)
278
278
  end
@@ -287,27 +287,27 @@ describe Rpush::Daemon::Store::ActiveRecord do
287
287
 
288
288
  it 'sets the given attributes' do
289
289
  new_notification = store.create_gcm_notification(*args)
290
- new_notification.device_token.should eq 'ab' * 32
290
+ expect(new_notification.device_token).to eq 'ab' * 32
291
291
  end
292
292
 
293
293
  it 'sets the given data' do
294
294
  new_notification = store.create_gcm_notification(*args)
295
- new_notification.data['data'].should be_true
295
+ expect(new_notification.data['data']).to be_truthy
296
296
  end
297
297
 
298
298
  it 'sets the given registration IDs' do
299
299
  new_notification = store.create_gcm_notification(*args)
300
- new_notification.registration_ids.should eq registration_ids
300
+ expect(new_notification.registration_ids).to eq registration_ids
301
301
  end
302
302
 
303
303
  it 'sets the deliver_after timestamp' do
304
304
  new_notification = store.create_gcm_notification(*args)
305
- new_notification.deliver_after.to_s.should eq deliver_after.to_s
305
+ expect(new_notification.deliver_after.to_s).to eq deliver_after.to_s
306
306
  end
307
307
 
308
308
  it 'saves the new notification' do
309
309
  new_notification = store.create_gcm_notification(*args)
310
- new_notification.new_record?.should be_false
310
+ expect(new_notification.new_record?).to be_falsey
311
311
  end
312
312
  end
313
313
 
@@ -320,29 +320,29 @@ describe Rpush::Daemon::Store::ActiveRecord do
320
320
 
321
321
  it 'sets the given attributes' do
322
322
  new_notification = store.create_adm_notification(*args)
323
- new_notification.app_id.should eq app.id
324
- new_notification.collapse_key.should eq 'ckey'
325
- new_notification.delay_while_idle.should be_true
323
+ expect(new_notification.app_id).to eq app.id
324
+ expect(new_notification.collapse_key).to eq 'ckey'
325
+ expect(new_notification.delay_while_idle).to be_truthy
326
326
  end
327
327
 
328
328
  it 'sets the given data' do
329
329
  new_notification = store.create_adm_notification(*args)
330
- new_notification.data['data'].should be_true
330
+ expect(new_notification.data['data']).to be_truthy
331
331
  end
332
332
 
333
333
  it 'sets the given registration IDs' do
334
334
  new_notification = store.create_adm_notification(*args)
335
- new_notification.registration_ids.should eq registration_ids
335
+ expect(new_notification.registration_ids).to eq registration_ids
336
336
  end
337
337
 
338
338
  it 'sets the deliver_after timestamp' do
339
339
  new_notification = store.create_adm_notification(*args)
340
- new_notification.deliver_after.to_s.should eq deliver_after.to_s
340
+ expect(new_notification.deliver_after.to_s).to eq deliver_after.to_s
341
341
  end
342
342
 
343
343
  it 'saves the new notification' do
344
344
  new_notification = store.create_adm_notification(*args)
345
- new_notification.new_record?.should be_false
345
+ expect(new_notification.new_record?).to be_falsey
346
346
  end
347
347
  end
348
348
  end