rpush 2.3.1-java → 2.3.2-java

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.
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
@@ -9,58 +9,61 @@ describe Rpush::Daemon, "when starting" do
9
9
  let(:logger) { double(:logger, info: nil, error: nil, warn: nil, internal_logger: nil) }
10
10
 
11
11
  before do
12
- Rpush.stub(logger: logger)
13
- Rpush::Daemon::Feeder.stub(:start)
14
- Rpush::Daemon::Synchronizer.stub(sync: nil)
15
- Rpush::Daemon::AppRunner.stub(stop: nil)
16
- Rpush::Daemon.stub(exit: nil, puts: nil)
17
- Rpush::Daemon::SignalHandler.stub(start: nil, stop: nil, handle_shutdown_signal: nil)
18
- Process.stub(:daemon)
19
- File.stub(:open)
12
+ allow(Rpush).to receive(:logger) { logger }
13
+ allow(Rpush::Daemon::Feeder).to receive(:start)
14
+ allow(Rpush::Daemon::Synchronizer).to receive(:sync)
15
+ allow(Rpush::Daemon::AppRunner).to receive(:stop)
16
+ allow(Rpush::Daemon).to receive(:exit)
17
+ allow(Rpush::Daemon).to receive(:puts)
18
+ allow(Rpush::Daemon::SignalHandler).to receive(:start)
19
+ allow(Rpush::Daemon::SignalHandler).to receive(:stop)
20
+ allow(Rpush::Daemon::SignalHandler).to receive(:handle_shutdown_signal)
21
+ allow(Process).to receive(:daemon)
22
+ allow(File).to receive(:open)
20
23
  end
21
24
 
22
25
  unless Rpush.jruby?
23
26
  it "forks into a daemon if the foreground option is false" do
24
27
  Rpush.config.foreground = false
25
28
  Rpush::Daemon.common_init
26
- Process.should_receive(:daemon)
29
+ expect(Process).to receive(:daemon)
27
30
  Rpush::Daemon.start
28
31
  end
29
32
 
30
33
  it "does not fork into a daemon if the foreground option is true" do
31
34
  Rpush.config.foreground = true
32
- Process.should_not_receive(:daemon)
35
+ expect(Process).to_not receive(:daemon)
33
36
  Rpush::Daemon.start
34
37
  end
35
38
 
36
39
  it "does not fork into a daemon if the push option is true" do
37
40
  Rpush.config.push = true
38
- Process.should_not_receive(:daemon)
41
+ expect(Process).to_not receive(:daemon)
39
42
  Rpush::Daemon.start
40
43
  end
41
44
 
42
45
  it "does not fork into a daemon if the embedded option is true" do
43
46
  Rpush.config.embedded = true
44
- Process.should_not_receive(:daemon)
47
+ expect(Process).to_not receive(:daemon)
45
48
  Rpush::Daemon.start
46
49
  end
47
50
  end
48
51
 
49
52
  it 'releases the store connection' do
50
53
  Rpush::Daemon.store = double
51
- Rpush::Daemon.store.should_receive(:release_connection)
54
+ expect(Rpush::Daemon.store).to receive(:release_connection)
52
55
  Rpush::Daemon.start
53
56
  end
54
57
 
55
58
  it 'sets up setup signal traps' do
56
- Rpush::Daemon::SignalHandler.should_receive(:start)
59
+ expect(Rpush::Daemon::SignalHandler).to receive(:start)
57
60
  Rpush::Daemon.start
58
61
  end
59
62
 
60
63
  it 'instantiates the store' do
61
64
  Rpush.config.client = :active_record
62
65
  Rpush::Daemon.start
63
- Rpush::Daemon.store.should be_kind_of(Rpush::Daemon::Store::ActiveRecord)
66
+ expect(Rpush::Daemon.store).to be_kind_of(Rpush::Daemon::Store::ActiveRecord)
64
67
  end
65
68
 
66
69
  it 'initializes plugins' do
@@ -68,65 +71,65 @@ describe Rpush::Daemon, "when starting" do
68
71
  did_init = false
69
72
  plugin.init { did_init = true }
70
73
  Rpush::Daemon.common_init
71
- expect(did_init).to be_true
74
+ expect(did_init).to eq(true)
72
75
  end
73
76
 
74
77
  it 'logs an error if the store cannot be loaded' do
75
78
  Rpush.config.client = :foo_bar
76
- Rpush.logger.should_receive(:error).with(kind_of(LoadError))
77
- Rpush::Daemon.stub(:exit) { Rpush::Daemon.store = double.as_null_object }
79
+ expect(Rpush.logger).to receive(:error).with(kind_of(LoadError))
80
+ allow(Rpush::Daemon).to receive(:exit) { Rpush::Daemon.store = double.as_null_object }
78
81
  Rpush::Daemon.start
79
82
  end
80
83
 
81
84
  it "writes the process ID to the PID file" do
82
- Rpush::Daemon.should_receive(:write_pid_file)
85
+ expect(Rpush::Daemon).to receive(:write_pid_file)
83
86
  Rpush::Daemon.start
84
87
  end
85
88
 
86
89
  it "logs an error if the PID file could not be written" do
87
90
  Rpush.config.pid_file = '/rails_root/rpush.pid'
88
- File.stub(:open).and_raise(Errno::ENOENT)
89
- logger.should_receive(:error).with(%r{Failed to write PID to '/rails_root/rpush\.pid'})
91
+ allow(File).to receive(:open).and_raise(Errno::ENOENT)
92
+ expect(logger).to receive(:error).with(%r{Failed to write PID to '/rails_root/rpush\.pid'})
90
93
  Rpush::Daemon.start
91
94
  end
92
95
 
93
96
  it "starts the feeder" do
94
- Rpush::Daemon::Feeder.should_receive(:start)
97
+ expect(Rpush::Daemon::Feeder).to receive(:start)
95
98
  Rpush::Daemon.start
96
99
  end
97
100
 
98
101
  it "syncs apps" do
99
- Rpush::Daemon::Synchronizer.should_receive(:sync)
102
+ expect(Rpush::Daemon::Synchronizer).to receive(:sync)
100
103
  Rpush::Daemon.start
101
104
  end
102
105
 
103
106
  describe "shutdown" do
104
107
  it "stops the feeder" do
105
- Rpush::Daemon::Feeder.should_receive(:stop)
108
+ expect(Rpush::Daemon::Feeder).to receive(:stop)
106
109
  Rpush::Daemon.shutdown
107
110
  end
108
111
 
109
112
  it "stops the app runners" do
110
- Rpush::Daemon::AppRunner.should_receive(:stop)
113
+ expect(Rpush::Daemon::AppRunner).to receive(:stop)
111
114
  Rpush::Daemon.shutdown
112
115
  end
113
116
 
114
117
  it "removes the PID file if one was written" do
115
118
  Rpush.config.pid_file = "/rails_root/rpush.pid"
116
- File.stub(:exist?).and_return(true)
117
- File.should_receive(:delete).with("/rails_root/rpush.pid")
119
+ allow(File).to receive(:exist?) { true }
120
+ expect(File).to receive(:delete).with("/rails_root/rpush.pid")
118
121
  Rpush::Daemon.shutdown
119
122
  end
120
123
 
121
124
  it "does not attempt to remove the PID file if it does not exist" do
122
- File.stub(:exists?).and_return(false)
123
- File.should_not_receive(:delete)
125
+ allow(File).to receive(:exist?) { false }
126
+ expect(File).to_not receive(:delete)
124
127
  Rpush::Daemon.shutdown
125
128
  end
126
129
 
127
130
  it "does not attempt to remove the PID file if one was not written" do
128
131
  Rpush.config.pid_file = nil
129
- File.should_not_receive(:delete)
132
+ expect(File).to_not receive(:delete)
130
133
  Rpush::Daemon.shutdown
131
134
  end
132
135
  end
@@ -17,16 +17,16 @@ describe Rpush::Deprecatable do
17
17
  let(:klass) { HasDeprecatedMethod.new }
18
18
 
19
19
  before do
20
- Rpush::Deprecation.stub(:warn)
20
+ allow(Rpush::Deprecation).to receive(:warn)
21
21
  end
22
22
 
23
23
  it 'warns the method is deprecated when called' do
24
- Rpush::Deprecation.should_receive(:warn).with(/deprecated_method is deprecated and will be removed from Rpush 4\.0\./)
24
+ expect(Rpush::Deprecation).to receive(:warn).with(/deprecated_method is deprecated and will be removed from Rpush 4\.0\./)
25
25
  klass.deprecated_method
26
26
  end
27
27
 
28
28
  it 'calls the original method' do
29
29
  klass.deprecated_method
30
- klass.original_called?.should be_true
30
+ expect(klass.original_called?).to eq(true)
31
31
  end
32
32
  end
@@ -2,12 +2,12 @@ require 'unit_spec_helper'
2
2
 
3
3
  describe Rpush::Deprecation do
4
4
  it 'prints a warning' do
5
- STDERR.should_receive(:puts).with("DEPRECATION WARNING: msg")
5
+ expect(STDERR).to receive(:puts).with("DEPRECATION WARNING: msg")
6
6
  Rpush::Deprecation.warn("msg")
7
7
  end
8
8
 
9
9
  it 'does not print a warning when muted' do
10
- STDERR.should_not_receive(:puts)
10
+ expect(STDERR).not_to receive(:puts)
11
11
  Rpush::Deprecation.muted do
12
12
  Rpush::Deprecation.warn("msg")
13
13
  end
@@ -2,19 +2,19 @@ require 'unit_spec_helper'
2
2
 
3
3
  describe Rpush, 'embed' do
4
4
  before do
5
- Rpush::Daemon.stub(start: nil, shutdown: nil)
6
- Kernel.stub(:at_exit)
5
+ allow(Rpush::Daemon).to receive_messages(start: nil, shutdown: nil)
6
+ allow(Kernel).to receive(:at_exit)
7
7
  end
8
8
 
9
9
  after { Rpush.shutdown }
10
10
 
11
11
  it 'sets the embedded config option to true' do
12
12
  Rpush.embed
13
- Rpush.config.embedded.should be_true
13
+ expect(Rpush.config.embedded).to eq(true)
14
14
  end
15
15
 
16
16
  it 'starts the daemon' do
17
- Rpush::Daemon.should_receive(:start)
17
+ expect(Rpush::Daemon).to receive(:start)
18
18
  Rpush.embed
19
19
  end
20
20
 
@@ -28,7 +28,7 @@ describe Rpush, 'shutdown' do
28
28
  before { Rpush.config.embedded = true }
29
29
 
30
30
  it 'shuts down the daemon' do
31
- Rpush::Daemon.should_receive(:shutdown)
31
+ expect(Rpush::Daemon).to receive(:shutdown)
32
32
  Rpush.shutdown
33
33
  end
34
34
  end
@@ -37,7 +37,7 @@ describe Rpush, 'sync' do
37
37
  before { Rpush.config.embedded = true }
38
38
 
39
39
  it 'syncs' do
40
- Rpush::Daemon::Synchronizer.should_receive(:sync)
40
+ expect(Rpush::Daemon::Synchronizer).to receive(:sync)
41
41
  Rpush.sync
42
42
  end
43
43
  end
@@ -46,7 +46,7 @@ describe Rpush, 'debug' do
46
46
  before { Rpush.config.embedded = true }
47
47
 
48
48
  it 'debugs the AppRunner' do
49
- Rpush::Daemon::AppRunner.should_receive(:debug)
49
+ expect(Rpush::Daemon::AppRunner).to receive(:debug)
50
50
  Rpush.debug
51
51
  end
52
52
  end
@@ -9,34 +9,34 @@ describe Rpush::Logger do
9
9
 
10
10
  before do
11
11
  @logger_class = defined?(ActiveSupport::BufferedLogger) ? ActiveSupport::BufferedLogger : ActiveSupport::Logger
12
- @logger = double(@logger_class.name, info: nil, error: nil, level: 0, auto_flushing: 1, :auto_flushing= => nil)
13
- @logger_class.stub(:new).and_return(@logger)
14
- Rails.stub(logger: @logger)
15
- File.stub(open: log)
16
- FileUtils.stub(mkdir_p: nil)
17
- STDERR.stub(:puts)
12
+ @logger = double(@logger_class.name, info: nil, error: nil, level: 0, auto_flushing: true, :auto_flushing= => nil)
13
+ allow(@logger_class).to receive(:new).and_return(@logger)
14
+ allow(Rails).to receive_messages(logger: @logger)
15
+ allow(File).to receive_messages(open: log)
16
+ allow(FileUtils).to receive_messages(mkdir_p: nil)
17
+ allow(STDERR).to receive(:puts)
18
18
  Rpush.config.foreground = true
19
19
  Rpush.config.log_file = 'log/rpush.log'
20
20
  end
21
21
 
22
22
  it "disables logging if the log file cannot be opened" do
23
- File.stub(:open).and_raise(Errno::ENOENT)
24
- STDERR.should_receive(:puts).with(/Logging disabled/)
23
+ allow(File).to receive(:open).and_raise(Errno::ENOENT)
24
+ expect(STDERR).to receive(:puts).with(/Logging disabled/)
25
25
  Rpush::Logger.new
26
26
  end
27
27
 
28
28
  it 'creates the log directory' do
29
- FileUtils.should_receive(:mkdir_p).with('/tmp/rails_root/log')
29
+ expect(FileUtils).to receive(:mkdir_p).with('/tmp/rails_root/log')
30
30
  Rpush::Logger.new
31
31
  end
32
32
 
33
33
  it "should open the a log file in the Rails log directory" do
34
- File.should_receive(:open).with('/tmp/rails_root/log/rpush.log', 'a')
34
+ expect(File).to receive(:open).with('/tmp/rails_root/log/rpush.log', 'a')
35
35
  Rpush::Logger.new
36
36
  end
37
37
 
38
38
  it 'sets sync mode on the log descriptor' do
39
- log.should_receive(:sync=).with(true)
39
+ expect(log).to receive(:sync=).with(true)
40
40
  Rpush::Logger.new
41
41
  end
42
42
 
@@ -44,28 +44,28 @@ describe Rpush::Logger do
44
44
  my_logger = double
45
45
  Rpush.config.logger = my_logger
46
46
  logger = Rpush::Logger.new
47
- my_logger.should_receive(:info)
47
+ expect(my_logger).to receive(:info)
48
48
  Rpush.config.foreground = false
49
49
  logger.info('test')
50
50
  end
51
51
 
52
52
  it 'uses ActiveSupport::BufferedLogger if a user-defined logger is not set' do
53
53
  if ActiveSupport.const_defined?('BufferedLogger')
54
- ActiveSupport::BufferedLogger.should_receive(:new).with(log, Rails.logger.level)
54
+ expect(ActiveSupport::BufferedLogger).to receive(:new).with(log, Rails.logger.level)
55
55
  Rpush::Logger.new
56
56
  end
57
57
  end
58
58
 
59
59
  it 'uses ActiveSupport::Logger if BufferedLogger does not exist' do
60
60
  stub_const('ActiveSupport::Logger', double)
61
- ActiveSupport.stub(:const_defined? => false)
62
- ActiveSupport::Logger.should_receive(:new).with(log, Rails.logger.level)
61
+ allow(ActiveSupport).to receive_messages(:const_defined? => false)
62
+ expect(ActiveSupport::Logger).to receive(:new).with(log, Rails.logger.level)
63
63
  Rpush::Logger.new
64
64
  end
65
65
 
66
66
  it "should print out the msg if running in the foreground" do
67
67
  logger = Rpush::Logger.new
68
- STDOUT.should_receive(:puts).with(/hi mom/)
68
+ expect(STDOUT).to receive(:puts).with(/hi mom/)
69
69
  logger.info("hi mom")
70
70
  end
71
71
 
@@ -73,7 +73,7 @@ describe Rpush::Logger do
73
73
  it "should not print out the msg if not running in the foreground" do
74
74
  Rpush.config.foreground = false
75
75
  logger = Rpush::Logger.new
76
- STDOUT.should_not_receive(:puts).with(/hi mom/)
76
+ expect(STDOUT).not_to receive(:puts).with(/hi mom/)
77
77
  logger.info("hi mom")
78
78
  end
79
79
  end
@@ -81,38 +81,38 @@ describe Rpush::Logger do
81
81
  it "should prefix log lines with the current time" do
82
82
  Rpush.config.foreground = false
83
83
  now = Time.now
84
- Time.stub(:now).and_return(now)
84
+ allow(Time).to receive(:now).and_return(now)
85
85
  logger = Rpush::Logger.new
86
- @logger.should_receive(:info).with(/#{Regexp.escape("[#{now.to_s(:db)}]")}/)
86
+ expect(@logger).to receive(:info).with(/#{Regexp.escape("[#{now.to_s(:db)}]")}/)
87
87
  logger.info("blah")
88
88
  end
89
89
 
90
90
  it "should prefix error logs with the ERROR label" do
91
91
  Rpush.config.foreground = false
92
92
  logger = Rpush::Logger.new
93
- @logger.should_receive(:error).with(/#{Regexp.escape("[ERROR]")}/)
93
+ expect(@logger).to receive(:error).with(/#{Regexp.escape("[ERROR]")}/)
94
94
  logger.error("eeek")
95
95
  end
96
96
 
97
97
  it "should prefix warn logs with the WARNING label" do
98
98
  Rpush.config.foreground = false
99
99
  logger = Rpush::Logger.new
100
- @logger.should_receive(:warn).with(/#{Regexp.escape("[WARNING]")}/)
100
+ expect(@logger).to receive(:warn).with(/#{Regexp.escape("[WARNING]")}/)
101
101
  logger.warn("eeek")
102
102
  end
103
103
 
104
104
  it "should handle an Exception instance" do
105
105
  Rpush.config.foreground = false
106
106
  e = RuntimeError.new("hi mom")
107
- e.stub(backtrace: [])
107
+ allow(e).to receive_messages(backtrace: [])
108
108
  logger = Rpush::Logger.new
109
- @logger.should_receive(:error).with(/RuntimeError, hi mom/)
109
+ expect(@logger).to receive(:error).with(/RuntimeError, hi mom/)
110
110
  logger.error(e)
111
111
  end
112
112
 
113
113
  it 'defaults auto_flushing to true if the Rails logger does not respond to auto_flushing' do
114
- Rails.stub(logger: double(info: nil, error: nil, level: 0))
114
+ allow(Rails).to receive_messages(logger: double(info: nil, error: nil, level: 0))
115
115
  Rpush::Logger.new
116
- @logger.auto_flushing.should be_true
116
+ expect(@logger.auto_flushing).to eq(true)
117
117
  end
118
118
  end
@@ -1,18 +1,18 @@
1
1
  shared_examples_for "an Notification subclass" do
2
2
  describe "when assigning data for the device" do
3
- before { Rpush::Deprecation.stub(:warn) }
3
+ before { allow(Rpush::Deprecation).to receive(:warn) }
4
4
 
5
5
  it "calls MultiJson.dump when multi_json responds to :dump" do
6
6
  notification = notification_class.new
7
- MultiJson.stub(:respond_to?).with(:dump).and_return(true)
8
- MultiJson.should_receive(:dump).with(any_args)
7
+ allow(MultiJson).to receive(:respond_to?).with(:dump).and_return(true)
8
+ expect(MultiJson).to receive(:dump).with(any_args)
9
9
  notification.data = { pirates: 1 }
10
10
  end
11
11
 
12
12
  it "calls MultiJson.encode when multi_json does not respond to :dump" do
13
13
  notification = notification_class.new
14
- MultiJson.stub(:respond_to?).with(:dump).and_return(false)
15
- MultiJson.should_receive(:encode).with(any_args)
14
+ allow(MultiJson).to receive(:respond_to?).with(:dump).and_return(false)
15
+ expect(MultiJson).to receive(:encode).with(any_args)
16
16
  notification.data = { ninjas: 1 }
17
17
  end
18
18
 
@@ -24,12 +24,12 @@ shared_examples_for "an Notification subclass" do
24
24
 
25
25
  it "encodes the given Hash as JSON" do
26
26
  notification.data = { hi: "mom" }
27
- notification.read_attribute(:data).should eq("{\"hi\":\"mom\"}")
27
+ expect(notification.read_attribute(:data)).to eq("{\"hi\":\"mom\"}")
28
28
  end
29
29
 
30
30
  it "decodes the JSON when using the reader method" do
31
31
  notification.data = { hi: "mom" }
32
- notification.data.should eq("hi" => "mom")
32
+ expect(notification.data).to eq("hi" => "mom")
33
33
  end
34
34
  end
35
35
  end
@@ -20,7 +20,7 @@ describe Rpush::Plugin do
20
20
  plugin.configure do |config|
21
21
  config.is_configured = true
22
22
  end
23
- expect(Rpush.config.plugin.test.is_configured).to be_true
23
+ expect(Rpush.config.plugin.test.is_configured).to eq(true)
24
24
  end
25
25
 
26
26
  it 'can hook up reflections' do
@@ -2,33 +2,33 @@ require 'unit_spec_helper'
2
2
 
3
3
  describe Rpush, 'push' do
4
4
  before do
5
- Rpush::Daemon::Synchronizer.stub(sync: nil)
6
- Rpush::Daemon::AppRunner.stub(wait: nil)
7
- Rpush::Daemon::Feeder.stub(start: nil)
5
+ allow(Rpush::Daemon::Synchronizer).to receive_messages(sync: nil)
6
+ allow(Rpush::Daemon::AppRunner).to receive_messages(wait: nil)
7
+ allow(Rpush::Daemon::Feeder).to receive_messages(start: nil)
8
8
  end
9
9
 
10
10
  it 'sets the push config option to true' do
11
11
  Rpush.push
12
- Rpush.config.push.should be_true
12
+ expect(Rpush.config.push).to eq(true)
13
13
  end
14
14
 
15
15
  it 'initializes the daemon' do
16
- Rpush::Daemon.should_receive(:common_init)
16
+ expect(Rpush::Daemon).to receive(:common_init)
17
17
  Rpush.push
18
18
  end
19
19
 
20
20
  it 'syncs' do
21
- Rpush::Daemon::Synchronizer.should_receive(:sync)
21
+ expect(Rpush::Daemon::Synchronizer).to receive(:sync)
22
22
  Rpush.push
23
23
  end
24
24
 
25
25
  it 'starts the feeder' do
26
- Rpush::Daemon::Feeder.should_receive(:start)
26
+ expect(Rpush::Daemon::Feeder).to receive(:start)
27
27
  Rpush.push
28
28
  end
29
29
 
30
30
  it 'stops on the app runner' do
31
- Rpush::Daemon::AppRunner.should_receive(:stop)
31
+ expect(Rpush::Daemon::AppRunner).to receive(:stop)
32
32
  Rpush.push
33
33
  end
34
34