Sha256: a7c305409b6ae36f307442c7e31008e8b73239d969cea9f255b350547b44c0b5

Contents?: true

Size: 1.33 KB

Versions: 7

Compression:

Stored size: 1.33 KB

Contents

# encoding: utf-8
require 'spec_helper'

describe Ably::Rest::Channels do
  shared_examples 'a channel' do
    it 'returns a channel object' do
      expect(channel).to be_a Ably::Rest::Channel
      expect(channel.name).to eql(channel_name)
    end

    it 'returns channel object and passes the provided options' do
      expect(channel_with_options.options).to eql(options)
    end
  end

  vary_by_protocol do
    let(:client) do
      Ably::Rest::Client.new(api_key: api_key, environment: environment, protocol: protocol)
    end
    let(:channel_name) { random_str }
    let(:options)      { { key: 'value' } }

    describe 'using shortcut method #channel on the client object' do
      let(:channel) { client.channel(channel_name) }
      let(:channel_with_options) { client.channel(channel_name, options) }
      it_behaves_like 'a channel'
    end

    describe 'using #get method on client#channels' do
      let(:channel) { client.channels.get(channel_name) }
      let(:channel_with_options) { client.channels.get(channel_name, options) }
      it_behaves_like 'a channel'
    end

    describe 'using undocumented array accessor [] method on client#channels' do
      let(:channel) { client.channels[channel_name] }
      let(:channel_with_options) { client.channels[channel_name, options] }
      it_behaves_like 'a channel'
    end
  end
end

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
ably-rest-0.7.5 lib/submodules/ably-ruby/spec/acceptance/rest/channels_spec.rb
ably-0.7.5 spec/acceptance/rest/channels_spec.rb
ably-0.7.4 spec/acceptance/rest/channels_spec.rb
ably-rest-0.7.3 lib/submodules/ably-ruby/spec/acceptance/rest/channels_spec.rb
ably-0.7.2 spec/acceptance/rest/channels_spec.rb
ably-0.7.1 spec/acceptance/rest/channels_spec.rb
ably-0.7.0 spec/acceptance/rest/channels_spec.rb