rpush 2.3.2 → 2.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +13 -0
- data/README.md +1 -1
- data/lib/generators/rpush_migration_generator.rb +21 -6
- data/lib/generators/templates/rpush.rb +5 -5
- data/lib/generators/templates/rpush_2_0_0_updates.rb +24 -0
- data/lib/rpush/client/active_model/apns/notification.rb +1 -1
- data/lib/rpush/client/mongoid.rb +31 -0
- data/lib/rpush/client/mongoid/adm/app.rb +14 -0
- data/lib/rpush/client/mongoid/adm/notification.rb +11 -0
- data/lib/rpush/client/mongoid/apns/app.rb +11 -0
- data/lib/rpush/client/mongoid/apns/feedback.rb +21 -0
- data/lib/rpush/client/mongoid/apns/notification.rb +15 -0
- data/lib/rpush/client/mongoid/app.rb +23 -0
- data/lib/rpush/client/mongoid/gcm/app.rb +11 -0
- data/lib/rpush/client/mongoid/gcm/notification.rb +11 -0
- data/lib/rpush/client/mongoid/notification.rb +43 -0
- data/lib/rpush/client/mongoid/wpns/app.rb +11 -0
- data/lib/rpush/client/mongoid/wpns/notification.rb +11 -0
- data/lib/rpush/client/redis.rb +2 -2
- data/lib/rpush/configuration.rb +48 -29
- data/lib/rpush/daemon/adm/delivery.rb +1 -1
- data/lib/rpush/daemon/apns.rb +1 -1
- data/lib/rpush/daemon/apns/feedback_receiver.rb +2 -3
- data/lib/rpush/daemon/dispatcher/apns_tcp.rb +2 -1
- data/lib/rpush/daemon/feeder.rb +4 -7
- data/lib/rpush/daemon/gcm/delivery.rb +1 -1
- data/lib/rpush/daemon/interruptible_sleep.rb +5 -50
- data/lib/rpush/daemon/proc_title.rb +2 -1
- data/lib/rpush/daemon/store/active_record.rb +4 -0
- data/lib/rpush/daemon/store/interface.rb +1 -1
- data/lib/rpush/daemon/store/mongoid.rb +157 -0
- data/lib/rpush/daemon/store/redis.rb +6 -2
- data/lib/rpush/deprecatable.rb +1 -2
- data/lib/rpush/deprecation.rb +6 -0
- data/lib/rpush/embed.rb +5 -0
- data/lib/rpush/logger.rb +5 -8
- data/lib/rpush/push.rb +5 -0
- data/lib/rpush/version.rb +1 -1
- data/lib/tasks/quality.rake +1 -1
- data/lib/tasks/test.rake +9 -4
- data/spec/functional/apns_spec.rb +2 -1
- data/spec/functional_spec_helper.rb +2 -2
- data/spec/spec_helper.rb +18 -7
- data/spec/support/config/mongoid.yml +69 -0
- data/spec/support/mongoid_setup.rb +10 -0
- data/spec/unit/client/active_record/adm/app_spec.rb +1 -1
- data/spec/unit/client/active_record/adm/notification_spec.rb +1 -1
- data/spec/unit/client/active_record/apns/app_spec.rb +1 -1
- data/spec/unit/client/active_record/apns/feedback_spec.rb +1 -1
- data/spec/unit/client/active_record/apns/notification_spec.rb +11 -11
- data/spec/unit/client/active_record/app_spec.rb +1 -1
- data/spec/unit/client/active_record/gcm/notification_spec.rb +1 -1
- data/spec/unit/client/active_record/notification_spec.rb +1 -1
- data/spec/unit/client/active_record/wpns/notification_spec.rb +1 -1
- data/spec/unit/configuration_spec.rb +7 -0
- data/spec/unit/daemon/apns/feedback_receiver_spec.rb +5 -5
- data/spec/unit/daemon/feeder_spec.rb +2 -2
- data/spec/unit/daemon/proc_title_spec.rb +11 -0
- data/spec/unit/daemon/store/active_record/reconnectable_spec.rb +1 -1
- data/spec/unit/daemon/store/active_record_spec.rb +21 -12
- data/spec/unit/daemon/store/mongoid_spec.rb +339 -0
- data/spec/unit/daemon/store/redis_spec.rb +365 -0
- data/spec/unit/embed_spec.rb +4 -2
- data/spec/unit/logger_spec.rb +14 -5
- data/spec/unit/notification_shared.rb +1 -1
- data/spec/unit/push_spec.rb +4 -2
- data/spec/unit_spec_helper.rb +3 -3
- metadata +25 -2
data/lib/rpush/push.rb
CHANGED
@@ -2,6 +2,11 @@ module Rpush
|
|
2
2
|
def self.push(options = {})
|
3
3
|
require 'rpush/daemon'
|
4
4
|
|
5
|
+
unless options.empty?
|
6
|
+
warning = "Passing configuration options directly to Rpush.push is deprecated and will be removed from Rpush 2.5.0. Please setup configuration using Rpush.configure { |config| ... } before calling push."
|
7
|
+
Rpush::Deprecation.warn_with_backtrace(warning)
|
8
|
+
end
|
9
|
+
|
5
10
|
config = Rpush::ConfigurationWithoutDefaults.new
|
6
11
|
options.each { |k, v| config.send("#{k}=", v) }
|
7
12
|
config.push = true
|
data/lib/rpush/version.rb
CHANGED
data/lib/tasks/quality.rake
CHANGED
@@ -3,7 +3,7 @@ begin
|
|
3
3
|
|
4
4
|
desc 'Run cane to check quality metrics'
|
5
5
|
Cane::RakeTask.new(:cane_quality) do |cane|
|
6
|
-
cane.add_threshold 'coverage/covered_percent', :>=,
|
6
|
+
cane.add_threshold 'coverage/covered_percent', :>=, 80
|
7
7
|
cane.no_style = false
|
8
8
|
cane.style_measure = 1000
|
9
9
|
cane.no_doc = true
|
data/lib/tasks/test.rake
CHANGED
@@ -7,6 +7,11 @@ def cmd(str, clean_env = true)
|
|
7
7
|
retval
|
8
8
|
end
|
9
9
|
|
10
|
+
def add_ruby_dot_files
|
11
|
+
cmd("echo '#{RUBY_ENGINE}-#{RUBY_VERSION}' > .ruby-version")
|
12
|
+
cmd("echo 'rpush_test' > .ruby-gemset")
|
13
|
+
end
|
14
|
+
|
10
15
|
desc 'Build Rails app bundled with Rpush'
|
11
16
|
task :build_rails do
|
12
17
|
rpush_root = Dir.pwd
|
@@ -20,10 +25,10 @@ task :build_rails do
|
|
20
25
|
|
21
26
|
begin
|
22
27
|
Dir.chdir(path)
|
28
|
+
add_ruby_dot_files
|
23
29
|
cmd('echo "gem \'rake\'" >> Gemfile')
|
24
30
|
cmd('echo "gem \'pg\'" >> Gemfile')
|
25
|
-
cmd("echo \"gem 'rpush', :
|
26
|
-
cmd('bundle install')
|
31
|
+
cmd("echo \"gem 'rpush', path: '#{rpush_root}'\" >> Gemfile")
|
27
32
|
|
28
33
|
File.open('config/database.yml', 'w') do |fd|
|
29
34
|
fd.write(<<-YML)
|
@@ -51,11 +56,11 @@ task :build_standalone do
|
|
51
56
|
|
52
57
|
begin
|
53
58
|
Dir.chdir(path)
|
59
|
+
add_ruby_dot_files
|
54
60
|
cmd('echo "source \'https://rubygems.org\'" >> Gemfile')
|
55
61
|
cmd('echo "gem \'rake\'" >> Gemfile')
|
56
62
|
cmd('echo "gem \'rpush-redis\'" >> Gemfile')
|
57
|
-
cmd("echo \"gem 'rpush', :
|
58
|
-
cmd('bundle install')
|
63
|
+
cmd("echo \"gem 'rpush', path: '#{rpush_root}'\" >> Gemfile")
|
59
64
|
ensure
|
60
65
|
Dir.chdir(pwd)
|
61
66
|
end
|
@@ -55,7 +55,8 @@ describe 'APNs' do
|
|
55
55
|
end
|
56
56
|
|
57
57
|
def fail_notification(notification)
|
58
|
-
|
58
|
+
id = (defined?(Mongoid) && notification.is_a?(Mongoid::Document)) ? notification.integer_id : notification.id
|
59
|
+
allow(ssl_socket).to receive_messages(read: [8, 4, id].pack('ccN'))
|
59
60
|
enable_io_select
|
60
61
|
end
|
61
62
|
|
@@ -11,12 +11,12 @@ RSpec.configure do |config|
|
|
11
11
|
config.before(:each) do
|
12
12
|
Modis.with_connection do |redis|
|
13
13
|
redis.keys('rpush:*').each { |key| redis.del(key) }
|
14
|
-
end
|
14
|
+
end if redis?
|
15
15
|
|
16
16
|
Rpush.config.logger = ::Logger.new(STDOUT) if functional_example?(self.class.metadata)
|
17
17
|
end
|
18
18
|
|
19
19
|
config.after(:each) do
|
20
|
-
DatabaseCleaner.clean if functional_example?(self.class.metadata)
|
20
|
+
DatabaseCleaner.clean if active_record? && functional_example?(self.class.metadata)
|
21
21
|
end
|
22
22
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
ENV['RAILS_ENV'] = 'test'
|
2
|
-
client
|
2
|
+
def client
|
3
|
+
(ENV['CLIENT'] || :active_record).to_sym
|
4
|
+
end
|
3
5
|
|
4
6
|
require 'bundler/setup'
|
5
7
|
Bundler.require(:default)
|
@@ -21,7 +23,20 @@ require 'rpush/client/active_record'
|
|
21
23
|
require 'rpush/daemon/store/active_record'
|
22
24
|
require 'rpush/daemon/store/redis'
|
23
25
|
|
24
|
-
|
26
|
+
def active_record?
|
27
|
+
client == :active_record
|
28
|
+
end
|
29
|
+
|
30
|
+
def redis?
|
31
|
+
client == :redis
|
32
|
+
end
|
33
|
+
|
34
|
+
def mongoid?
|
35
|
+
client == :mongoid
|
36
|
+
end
|
37
|
+
|
38
|
+
require 'support/mongoid_setup' if mongoid?
|
39
|
+
require 'support/active_record_setup' if active_record?
|
25
40
|
|
26
41
|
RPUSH_ROOT = '/tmp/rails_root'
|
27
42
|
|
@@ -31,10 +46,6 @@ end
|
|
31
46
|
|
32
47
|
RPUSH_CLIENT = Rpush.config.client
|
33
48
|
|
34
|
-
def active_record?
|
35
|
-
Rpush.config.client == :active_record
|
36
|
-
end
|
37
|
-
|
38
49
|
path = File.join(File.dirname(__FILE__), 'support')
|
39
50
|
TEST_CERT = File.read(File.join(path, 'cert_without_password.pem'))
|
40
51
|
TEST_CERT_WITH_PASSWORD = File.read(File.join(path, 'cert_with_password.pem'))
|
@@ -43,7 +54,7 @@ def after_example_cleanup
|
|
43
54
|
Rpush.logger = nil
|
44
55
|
Rpush::Daemon.store = nil
|
45
56
|
Rpush::Deprecation.muted do
|
46
|
-
Rpush.config
|
57
|
+
Rpush.config = nil
|
47
58
|
Rpush.config.client = RPUSH_CLIENT
|
48
59
|
end
|
49
60
|
Rpush.plugins.values.each(&:unload)
|
@@ -0,0 +1,69 @@
|
|
1
|
+
development:
|
2
|
+
# Configure available database sessions. (required)
|
3
|
+
sessions:
|
4
|
+
# Defines the default session. (required)
|
5
|
+
default:
|
6
|
+
# Defines the name of the default database that Mongoid can connect to.
|
7
|
+
# (required).
|
8
|
+
database: rpush_development
|
9
|
+
# Provides the hosts the default session can connect to. Must be an array
|
10
|
+
# of host:port pairs. (required)
|
11
|
+
hosts:
|
12
|
+
- localhost:27017
|
13
|
+
options:
|
14
|
+
# Change the default write concern. (default = { w: 1 })
|
15
|
+
# write:
|
16
|
+
# w: 1
|
17
|
+
|
18
|
+
# Change the default consistency model to primary, secondary.
|
19
|
+
# 'secondary' will send reads to secondaries, 'primary' sends everything
|
20
|
+
# to master. (default: primary)
|
21
|
+
# read: secondary_preferred
|
22
|
+
|
23
|
+
# How many times Moped should attempt to retry an operation after
|
24
|
+
# failure. (default: The number of nodes in the cluster)
|
25
|
+
# max_retries: 20
|
26
|
+
|
27
|
+
# The time in seconds that Moped should wait before retrying an
|
28
|
+
# operation on failure. (default: 0.25)
|
29
|
+
# retry_interval: 0.25
|
30
|
+
# Configure Mongoid specific options. (optional)
|
31
|
+
options:
|
32
|
+
# Includes the root model name in json serialization. (default: false)
|
33
|
+
# include_root_in_json: false
|
34
|
+
|
35
|
+
# Include the _type field in serialization. (default: false)
|
36
|
+
# include_type_for_serialization: false
|
37
|
+
|
38
|
+
# Preload all models in development, needed when models use
|
39
|
+
# inheritance. (default: false)
|
40
|
+
# preload_models: false
|
41
|
+
|
42
|
+
# Protect id and type from mass assignment. (default: true)
|
43
|
+
# protect_sensitive_fields: true
|
44
|
+
|
45
|
+
# Raise an error when performing a #find and the document is not found.
|
46
|
+
# (default: true)
|
47
|
+
# raise_not_found_error: true
|
48
|
+
|
49
|
+
# Raise an error when defining a scope with the same name as an
|
50
|
+
# existing method. (default: false)
|
51
|
+
# scope_overwrite_exception: false
|
52
|
+
|
53
|
+
# Use Active Support's time zone in conversions. (default: true)
|
54
|
+
# use_activesupport_time_zone: true
|
55
|
+
|
56
|
+
# Ensure all times are UTC in the app side. (default: false)
|
57
|
+
# use_utc: false
|
58
|
+
test:
|
59
|
+
sessions:
|
60
|
+
default:
|
61
|
+
database: rpush_test
|
62
|
+
hosts:
|
63
|
+
- localhost:27017
|
64
|
+
options:
|
65
|
+
read: primary
|
66
|
+
# In the test environment we lower the retries and retry interval to
|
67
|
+
# low amounts for fast failures.
|
68
|
+
max_retries: 1
|
69
|
+
retry_interval: 0
|
@@ -30,7 +30,7 @@ describe Rpush::Client::ActiveRecord::Apns::Notification do
|
|
30
30
|
it "should default the expiry to 1 day" do
|
31
31
|
expect(notification.expiry).to eq 1.day.to_i
|
32
32
|
end
|
33
|
-
end
|
33
|
+
end if active_record?
|
34
34
|
|
35
35
|
describe Rpush::Client::ActiveRecord::Apns::Notification, "when assigning the device token" do
|
36
36
|
it "should strip spaces from the given string" do
|
@@ -42,7 +42,7 @@ describe Rpush::Client::ActiveRecord::Apns::Notification, "when assigning the de
|
|
42
42
|
notification = Rpush::Client::ActiveRecord::Apns::Notification.new(device_token: "<omg>")
|
43
43
|
expect(notification.device_token).to eq "omg"
|
44
44
|
end
|
45
|
-
end
|
45
|
+
end if active_record?
|
46
46
|
|
47
47
|
describe Rpush::Client::ActiveRecord::Apns::Notification, "as_json" do
|
48
48
|
it "should include the alert if present" do
|
@@ -92,7 +92,7 @@ describe Rpush::Client::ActiveRecord::Apns::Notification, "as_json" do
|
|
92
92
|
notification.data = { omg: { ilike: :hashes } }
|
93
93
|
expect(notification.as_json["omg"]["ilike"]).to eq "hashes"
|
94
94
|
end
|
95
|
-
end
|
95
|
+
end if active_record?
|
96
96
|
|
97
97
|
describe Rpush::Client::ActiveRecord::Apns::Notification, 'MDM' do
|
98
98
|
let(:magic) { 'abc123' }
|
@@ -108,7 +108,7 @@ describe Rpush::Client::ActiveRecord::Apns::Notification, 'MDM' do
|
|
108
108
|
notification.mdm = magic
|
109
109
|
expect(notification.as_json.key?('aps')).to be_falsey
|
110
110
|
end
|
111
|
-
end
|
111
|
+
end if active_record?
|
112
112
|
|
113
113
|
describe Rpush::Client::ActiveRecord::Apns::Notification, 'content-available' do
|
114
114
|
let(:notification) { Rpush::Client::ActiveRecord::Apns::Notification.new }
|
@@ -140,7 +140,7 @@ describe Rpush::Client::ActiveRecord::Apns::Notification, 'content-available' do
|
|
140
140
|
expect(notification.as_json['aps']['content-available']).to eq 1
|
141
141
|
expect(notification.as_json['hi']).to eq 'mom'
|
142
142
|
end
|
143
|
-
end
|
143
|
+
end if active_record?
|
144
144
|
|
145
145
|
describe Rpush::Client::ActiveRecord::Apns::Notification, 'url-args' do
|
146
146
|
let(:notification) { Rpush::Client::ActiveRecord::Apns::Notification.new }
|
@@ -153,7 +153,7 @@ describe Rpush::Client::ActiveRecord::Apns::Notification, 'url-args' do
|
|
153
153
|
it 'does not include url-args in the payload if not set' do
|
154
154
|
expect(notification.as_json['aps'].key?('url-args')).to be_falsey
|
155
155
|
end
|
156
|
-
end
|
156
|
+
end if active_record?
|
157
157
|
|
158
158
|
describe Rpush::Client::ActiveRecord::Apns::Notification, 'category' do
|
159
159
|
let(:notification) { Rpush::Client::ActiveRecord::Apns::Notification.new }
|
@@ -166,7 +166,7 @@ describe Rpush::Client::ActiveRecord::Apns::Notification, 'category' do
|
|
166
166
|
it 'does not include category in the payload if not set' do
|
167
167
|
expect(notification.as_json['aps'].key?('category')).to be_falsey
|
168
168
|
end
|
169
|
-
end
|
169
|
+
end if active_record?
|
170
170
|
|
171
171
|
describe Rpush::Client::ActiveRecord::Apns::Notification, 'to_binary' do
|
172
172
|
let(:notification) { Rpush::Client::ActiveRecord::Apns::Notification.new }
|
@@ -206,7 +206,7 @@ describe Rpush::Client::ActiveRecord::Apns::Notification, 'to_binary' do
|
|
206
206
|
notification.app = Rpush::Client::ActiveRecord::Apns::App.new(name: 'my_app', environment: 'development', certificate: TEST_CERT)
|
207
207
|
expect(notification.to_binary).to eq "\x02\x00\x00\x00\x99\x01\x00 \xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\x02\x00a{\"aps\":{\"alert\":\"Don't panic Mr Mainwaring, don't panic!\",\"badge\":3,\"sound\":\"1.aiff\"},\"hi\":\"mom\"}\x03\x00\x04\x00\x00\x04\xD2\x04\x00\x04\x00\x01Q\x80\x05\x00\x01\n"
|
208
208
|
end
|
209
|
-
end
|
209
|
+
end if active_record?
|
210
210
|
|
211
211
|
describe Rpush::Client::ActiveRecord::Apns::Notification, "bug #31" do
|
212
212
|
it 'does not confuse a JSON looking string as JSON' do
|
@@ -221,7 +221,7 @@ describe Rpush::Client::ActiveRecord::Apns::Notification, "bug #31" do
|
|
221
221
|
notification.alert = "{\"one\":2}"
|
222
222
|
expect(notification.alert).to eq('one' => 2)
|
223
223
|
end
|
224
|
-
end
|
224
|
+
end if active_record?
|
225
225
|
|
226
226
|
describe Rpush::Client::ActiveRecord::Apns::Notification, "bug #35" do
|
227
227
|
it "should limit payload size to 256 bytes but not the entire packet" do
|
@@ -235,7 +235,7 @@ describe Rpush::Client::ActiveRecord::Apns::Notification, "bug #35" do
|
|
235
235
|
expect(notification.payload.bytesize).to be < 256
|
236
236
|
expect(notification).to be_valid
|
237
237
|
end
|
238
|
-
end
|
238
|
+
end if active_record?
|
239
239
|
|
240
240
|
describe Rpush::Client::ActiveRecord::Apns::Notification, "multi_json usage" do
|
241
241
|
describe Rpush::Client::ActiveRecord::Apns::Notification, "alert" do
|
@@ -253,4 +253,4 @@ describe Rpush::Client::ActiveRecord::Apns::Notification, "multi_json usage" do
|
|
253
253
|
notification.alert
|
254
254
|
end
|
255
255
|
end
|
256
|
-
end
|
256
|
+
end if active_record?
|
@@ -43,4 +43,11 @@ describe Rpush::Configuration do
|
|
43
43
|
Rpush.config.redis_options = { hi: :mom }
|
44
44
|
expect(Modis.redis_options).to eq(hi: :mom)
|
45
45
|
end
|
46
|
+
|
47
|
+
it 'deprecates feedback_poll=' do
|
48
|
+
expect(Rpush::Deprecation).to receive(:warn).with(/feedback_poll= is deprecated/)
|
49
|
+
expect do
|
50
|
+
Rpush.config.feedback_poll = 123
|
51
|
+
end.to change { Rpush.config.apns.feedback_receiver.frequency }.to(123)
|
52
|
+
end
|
46
53
|
end
|
@@ -4,7 +4,7 @@ require 'rpush/daemon/store/active_record'
|
|
4
4
|
describe Rpush::Daemon::Apns::FeedbackReceiver, 'check_for_feedback' do
|
5
5
|
let(:host) { 'feedback.push.apple.com' }
|
6
6
|
let(:port) { 2196 }
|
7
|
-
let(:
|
7
|
+
let(:frequency) { 60 }
|
8
8
|
let(:certificate) { double }
|
9
9
|
let(:password) { double }
|
10
10
|
let(:app) { double(name: 'my_app', password: password, certificate: certificate, environment: 'production') }
|
@@ -12,11 +12,11 @@ describe Rpush::Daemon::Apns::FeedbackReceiver, 'check_for_feedback' do
|
|
12
12
|
let(:logger) { double(error: nil, info: nil) }
|
13
13
|
let(:receiver) { Rpush::Daemon::Apns::FeedbackReceiver.new(app) }
|
14
14
|
let(:feedback) { double }
|
15
|
-
let(:sleeper) { double(Rpush::Daemon::InterruptibleSleep, sleep: nil,
|
15
|
+
let(:sleeper) { double(Rpush::Daemon::InterruptibleSleep, sleep: nil, stop: nil) }
|
16
16
|
let(:store) { double(Rpush::Daemon::Store::ActiveRecord, create_apns_feedback: feedback, release_connection: nil) }
|
17
17
|
|
18
18
|
before do
|
19
|
-
Rpush.config.
|
19
|
+
Rpush.config.apns.feedback_receiver.frequency = frequency
|
20
20
|
allow(Rpush::Daemon::InterruptibleSleep).to receive_messages(new: sleeper)
|
21
21
|
allow(Rpush).to receive_messages(logger: logger)
|
22
22
|
allow(Rpush::Daemon::TcpConnection).to receive_messages(new: connection)
|
@@ -33,8 +33,8 @@ describe Rpush::Daemon::Apns::FeedbackReceiver, 'check_for_feedback' do
|
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
36
|
-
it 'initializes the sleeper with the feedback polling
|
37
|
-
expect(Rpush::Daemon::InterruptibleSleep).to
|
36
|
+
it 'initializes the sleeper with the feedback polling frequency' do
|
37
|
+
expect(Rpush::Daemon::InterruptibleSleep).to receive_messages(new: sleeper)
|
38
38
|
Rpush::Daemon::Apns::FeedbackReceiver.new(app)
|
39
39
|
end
|
40
40
|
|
@@ -4,7 +4,7 @@ describe Rpush::Daemon::Feeder do
|
|
4
4
|
let!(:app) { Rpush::Apns::App.create!(name: 'my_app', environment: 'development', certificate: TEST_CERT) }
|
5
5
|
let(:notification) { Rpush::Apns::Notification.create!(device_token: "a" * 64, app: app) }
|
6
6
|
let(:logger) { double }
|
7
|
-
let(:interruptible_sleeper) { double(sleep: nil, stop: nil
|
7
|
+
let(:interruptible_sleeper) { double(sleep: nil, stop: nil) }
|
8
8
|
let(:store) { double(Rpush::Daemon::Store::ActiveRecord, deliverable_notifications: [notification], release_connection: nil) }
|
9
9
|
|
10
10
|
before do
|
@@ -86,7 +86,7 @@ describe Rpush::Daemon::Feeder do
|
|
86
86
|
|
87
87
|
describe 'wakeup' do
|
88
88
|
it 'interrupts sleep' do
|
89
|
-
expect(interruptible_sleeper).to receive(:
|
89
|
+
expect(interruptible_sleeper).to receive(:stop)
|
90
90
|
Rpush::Daemon::Feeder.start
|
91
91
|
Rpush::Daemon::Feeder.wakeup
|
92
92
|
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
require 'unit_spec_helper'
|
2
|
+
|
3
|
+
describe Rpush::Daemon::ProcTitle do
|
4
|
+
it 'sets the process title' do
|
5
|
+
Rpush.config.embedded = false
|
6
|
+
Rpush.config.push = false
|
7
|
+
allow(Rpush::Daemon::AppRunner).to receive_messages(total_dispatchers: 2, total_queued: 10)
|
8
|
+
expect(Process).to receive(:setproctitle).with('rpush | 10 queued | 2 dispatchers')
|
9
|
+
Rpush::Daemon::ProcTitle.update
|
10
|
+
end
|
11
|
+
end
|