spec/unit/realtime/connection_spec.rb in ably-0.7.2 vs spec/unit/realtime/connection_spec.rb in ably-0.7.4
- old
+ new
@@ -28,6 +28,36 @@
end
end
it_behaves_like 'an incoming protocol message bus'
it_behaves_like 'an outgoing protocol message bus'
+
+ describe 'connection resume callbacks', api_private: true do
+ let(:callbacks) { [] }
+
+ describe '#resumed' do
+ it 'triggers callbacks' do
+ subject.on_resume { callbacks << true }
+ subject.resumed
+ expect(callbacks.count).to eql(1)
+ end
+ end
+
+ describe '#on_resume' do
+ it 'registers a callback' do
+ subject.on_resume { callbacks << true }
+ subject.resumed
+ expect(callbacks.count).to eql(1)
+ end
+ end
+
+ describe '#off_resume' do
+ it 'registers a callback' do
+ subject.on_resume { callbacks << true }
+ additional_proc = proc { raise 'This should not be called' }
+ subject.off_resume &additional_proc
+ subject.resumed
+ expect(callbacks.count).to eql(1)
+ end
+ end
+ end
end