lib/submodules/ably-ruby/spec/acceptance/realtime/channel_spec.rb in ably-rest-0.8.14 vs lib/submodules/ably-ruby/spec/acceptance/realtime/channel_spec.rb in ably-rest-0.8.15

- old
+ new

@@ -90,16 +90,18 @@ context 'when state is :failed' do let(:client_options) { default_options.merge(log_level: :fatal) } it 'reattaches' do channel.attach do - channel.transition_state_machine :failed, reason: RuntimeError.new - expect(channel).to be_failed - channel.attach do - expect(channel).to be_attached - stop_reactor + channel.once(:failed) do + expect(channel).to be_failed + channel.attach do + expect(channel).to be_attached + stop_reactor + end end + channel.transition_state_machine :failed, reason: RuntimeError.new end end end context 'when state is :detaching' do @@ -369,10 +371,10 @@ # Check that all messages share the same protocol_message.id message_id = messages.map { |msg| msg.id.split(':')[0] } expect(message_id.uniq.count).to eql(1) # Check that messages use index 0,1,2 in the ID - message_indexes = messages.map { |msg| msg.id.split(':')[1] } + message_indexes = messages.map { |msg| msg.id.split(':').last } expect(message_indexes).to include("0", "1", "2") stop_reactor end end