spec/acceptance/realtime/auth_spec.rb in ably-1.1.0 vs spec/acceptance/realtime/auth_spec.rb in ably-1.1.1

- old
+ new

@@ -659,20 +659,22 @@ it 'is allowed (#RTC8a1)' do client.connection.once(:connected) do client.connection.once(:disconnected) { raise 'Upgrade does not require a disconnect' } channel = client.channels.get('foo') - channel.publish('not-allowed').errback do |error| - expect(error.code).to eql(40160) - expect(error.message).to match(/permission denied/) + channel.attach do + channel.publish('not-allowed').errback do |error| + expect(error.code).to eql(40160) + expect(error.message).to match(/permission denied/) - client.auth.authorize(nil, auth_callback: upgraded_token_cb) - client.connection.once(:update) do - expect(client.connection.error_reason).to be_nil - channel.subscribe('now-allowed') do |message| - stop_reactor + client.auth.authorize(nil, auth_callback: upgraded_token_cb) + client.connection.once(:update) do + expect(client.connection.error_reason).to be_nil + channel.subscribe('now-allowed') do |message| + stop_reactor + end + channel.publish 'now-allowed' end - channel.publish 'now-allowed' end end end end end