spec/unit/daemon/apns/feedback_receiver_spec.rb in rpush-4.1.1 vs spec/unit/daemon/apns/feedback_receiver_spec.rb in rpush-4.2.0
- old
+ new
@@ -5,11 +5,20 @@
let(:host) { 'feedback.push.apple.com' }
let(:port) { 2196 }
let(:frequency) { 60 }
let(:certificate) { double }
let(:password) { double }
- let(:app) { double(name: 'my_app', password: password, certificate: certificate, environment: 'production') }
+ let(:feedback_enabled) { true }
+ let(:app) do
+ double(
+ name: 'my_app',
+ password: password,
+ certificate: certificate,
+ feedback_enabled: feedback_enabled,
+ environment: 'production'
+ )
+ end
let(:connection) { double(connect: nil, read: nil, close: nil) }
let(:logger) { double(error: nil, info: nil) }
let(:receiver) { Rpush::Daemon::Apns::FeedbackReceiver.new(app) }
let(:feedback) { double }
let(:sleeper) { double(Rpush::Daemon::InterruptibleSleep, sleep: nil, stop: nil) }
@@ -90,9 +99,18 @@
end
it 'checks for feedback when started' do
expect(receiver).to receive(:check_for_feedback).at_least(:once)
receiver.start
+ end
+
+ context 'with feedback_enabled false' do
+ let(:feedback_enabled) { false }
+
+ it 'does not check for feedback when started' do
+ expect(receiver).not_to receive(:check_for_feedback)
+ receiver.start
+ end
end
end
describe 'stop' do
it 'interrupts sleep when stopped' do