lib/submodules/ably-ruby/spec/acceptance/realtime/presence_spec.rb in ably-rest-0.8.9 vs lib/submodules/ably-ruby/spec/acceptance/realtime/presence_spec.rb in ably-rest-0.8.13

- old
+ new

@@ -1461,9 +1461,28 @@ expect(client_one.connection).to be_connected expect(channel_client_one).to be_attached stop_reactor end end + + context 'with a callback that raises an exception' do + let(:exception) { StandardError.new("Intentional error") } + + it 'logs the error and continues' do + emitted_exception = false + expect(client_one.logger).to receive(:error).with(/#{exception.message}/) + presence_client_one.subscribe do |presence_message| + emitted_exception = true + raise exception + end + presence_client_one.enter do + EventMachine.add_timer(1) do + expect(emitted_exception).to eql(true) + stop_reactor + end + end + end + end end context '#unsubscribe' do context 'with no arguments' do it 'removes the callback for all presence events' do