lib/submodules/ably-ruby/spec/acceptance/realtime/channel_spec.rb in ably-rest-0.8.1 vs lib/submodules/ably-ruby/spec/acceptance/realtime/channel_spec.rb in ably-rest-0.8.2
- old
+ new
@@ -11,13 +11,13 @@
let(:payload) { random_str }
let(:channel) { client.channel(channel_name) }
let(:messages) { [] }
describe 'initialization' do
- context 'with :connect_automatically option set to false on connection' do
+ context 'with :auto_connect option set to false on connection' do
let(:client) do
- Ably::Realtime::Client.new(default_options.merge(connect_automatically: false))
+ Ably::Realtime::Client.new(default_options.merge(auto_connect: false))
end
it 'remains initialized when accessing a channel' do
client.channel('test')
EventMachine.add_timer(2) do
@@ -30,20 +30,10 @@
client.channel('test').attach do
expect(client.connection).to be_connected
stop_reactor
end
end
-
- it 'opens a connection implicitly when accessing #presence' do
- client.channel('test').tap do |channel|
- channel.on(:attached) do
- expect(client.connection).to be_connected
- stop_reactor
- end
- channel.presence
- end
- end
end
end
describe '#attach' do
it 'emits attaching then attached events' do
@@ -160,11 +150,11 @@
let(:restricted_client) do
Ably::Realtime::Client.new(default_options.merge(key: restricted_api_key, log_level: :fatal))
end
let(:restricted_channel) { restricted_client.channel("cannot_subscribe") }
- it 'triggers failed event' do
+ it 'emits failed event' do
restricted_channel.attach
restricted_channel.on(:failed) do |error|
expect(restricted_channel.state).to eq(:failed)
expect(error.status).to eq(401)
stop_reactor
@@ -177,11 +167,11 @@
expect(error.status).to eq(401)
stop_reactor
end
end
- it 'triggers an error event' do
+ it 'emits an error event' do
restricted_channel.attach
restricted_channel.on(:error) do |error|
expect(restricted_channel.state).to eq(:failed)
expect(error.status).to eq(401)
stop_reactor
@@ -456,10 +446,10 @@
end
fake_error connection_error
end
end
- it 'triggers an error event on the channel' do
+ it 'emits an error event on the channel' do
channel.attach do
channel.on(:error) do |error|
expect(error).to eql(connection_error)
stop_reactor
end