spec/acceptance/realtime/auth_spec.rb in ably-1.2.6 vs spec/acceptance/realtime/auth_spec.rb in ably-1.2.7
- old
+ new
@@ -615,21 +615,19 @@
client.connection.once(:connected) do
client.auth.authorize(nil, auth_callback: lambda { |token_params| "#{app_id}.invalid.token.will.cause.failure" }).tap do |deferrable|
deferrable.errback do |error|
EventMachine.add_timer(0.2) do
expect(connection_failed).to eql(true)
- expect(error.message).to match(/invalid.*accessToken/i)
expect(error.code).to eql(40005)
stop_reactor
end
end
deferrable.callback { raise "Authorize should not succed" }
end
end
client.connection.once(:failed) do
- expect(client.connection.error_reason.message).to match(/invalid.*accessToken/i)
expect(client.connection.error_reason.code).to eql(40005)
connection_failed = true
end
end
end
@@ -662,11 +660,10 @@
channel = client.channels.get('foo')
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|
@@ -1056,11 +1053,10 @@
context 'when credentials are wrong' do
let(:auth_params) { { keyName: key_name, keySecret: 'invalid' } }
it 'disconnected includes and invalid signature message' do
client.connection.once(:disconnected) do |state_change|
- expect(state_change.reason.message.match(/signature verification failed/i)).to_not be_nil
expect(state_change.reason.code).to eql(40144)
stop_reactor
end
client.connect
end
@@ -1109,11 +1105,10 @@
context 'when credentials are invalid' do
let(:auth_params) { { keyName: key_name, keySecret: 'invalid' } }
it 'authentication fails and reason for disconnection is invalid signature' do
client.connection.once(:disconnected) do |state_change|
- expect(state_change.reason.message.match(/signature verification failed/i)).to_not be_nil
expect(state_change.reason.code).to eql(40144)
stop_reactor
end
client.connect
end
@@ -1141,11 +1136,10 @@
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(/signature verification failed/i)).to_not be_nil
expect(state_change.reason.code).to eql(40144)
stop_reactor
end
client.connect
end
@@ -1246,10 +1240,9 @@
client.connection.once(:connected) do
forbidden_channel = client.channels.get(channel_name)
allowed_channel = client.channels.get(channel_with_publish_permissions)
forbidden_channel.publish('not-allowed').errback do |error|
expect(error.code).to eql(40160)
- expect(error.message).to match(/permission denied/)
allowed_channel.publish(message_name) do |message|
expect(message.name).to eql(message_name)
stop_reactor
end