lib/submodules/ably-ruby/spec/acceptance/realtime/auth_spec.rb in ably-rest-1.1.0 vs lib/submodules/ably-ruby/spec/acceptance/realtime/auth_spec.rb in ably-rest-1.1.2.rc1

- old
+ new

@@ -659,21 +659,23 @@ 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 @@ -1135,10 +1137,11 @@ end context 'when credentials are invalid' do let(:key_secret) { 'invalid' } let(:token) { Faraday.get("#{auth_url}?keyName=#{key_name}&keySecret=#{key_secret}").body } + let(:client_options) { { token: token, environment: environment, protocol: protocol, log_level: :none } } it 'fails with an invalid signature error' do client.connection.once(:disconnected) do |state_change| expect(state_change.reason.message.match(/invalid signature/i)).to_not be_nil expect(state_change.reason.code).to eql(40144) @@ -1235,10 +1238,10 @@ let(:auth_callback) do lambda do |token_params| Faraday.get("#{auth_url}?keyName=#{key_name}&keySecret=#{key_secret}&capability=#{URI.escape(basic_capability)}").body end end - let(:client_options) { default_options.merge(auth_callback: auth_callback) } + let(:client_options) { default_options.merge(auth_callback: auth_callback, log_level: :error) } it 'client fails to publish to a channel with subscribe-only capability and publishes successfully on a channel with permissions' do client.connection.once(:connected) do forbidden_channel = client.channels.get(channel_name) allowed_channel = client.channels.get(channel_with_publish_permissions)