lib/submodules/ably-ruby/spec/acceptance/realtime/channel_spec.rb in ably-rest-0.8.15 vs lib/submodules/ably-ruby/spec/acceptance/realtime/channel_spec.rb in ably-rest-0.9.0
- old
+ new
@@ -90,18 +90,16 @@
context 'when state is :failed' do
let(:client_options) { default_options.merge(log_level: :fatal) }
it 'reattaches' do
channel.attach do
- 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
+ expect(channel).to be_failed
+ channel.attach do
+ expect(channel).to be_attached
+ stop_reactor
+ end
end
end
end
context 'when state is :detaching' do
@@ -191,12 +189,12 @@
context 'and subsequent authorisation with suitable permissions' do
it 'attaches to the channel successfully and resets the channel error_reason' do
restricted_channel.attach
restricted_channel.once(:failed) do
restricted_client.close do
- # A direct call to #authorise is synchronous
- restricted_client.auth.authorise({}, key: api_key)
+ # A direct call to #authorize is synchronous
+ restricted_client.auth.authorize({}, key: api_key)
restricted_client.connect do
restricted_channel.once(:attached) do
expect(restricted_channel.error_reason).to be_nil
stop_reactor
@@ -371,10 +369,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(':').last }
+ message_indexes = messages.map { |msg| msg.id.split(':')[1] }
expect(message_indexes).to include("0", "1", "2")
stop_reactor
end
end