Sha256: 5309fa457ae8382ec8b0eebf6ce861152726f9490b18ad8650702b7362ac3452

Contents?: true

Size: 986 Bytes

Versions: 66

Compression:

Stored size: 986 Bytes

Contents

require 'spec_helper'

describe Ably::Realtime::Client, '#stats', :event_machine do
  vary_by_protocol do
    let(:client) do
      auto_close Ably::Realtime::Client.new(key: api_key, environment: environment, protocol: protocol)
    end

    describe 'fetching stats' do
      it 'returns a PaginatedResult' do
        client.stats do |stats|
          expect(stats).to be_a(Ably::Models::PaginatedResult)
          stop_reactor
        end
      end

      context 'with options' do
        let(:options) { { arbitrary: random_str } }

        it 'passes the option arguments to the REST stat method' do
          expect(client.rest_client).to receive(:stats).with(options)

          client.stats(options) do |stats|
            stop_reactor
          end
        end
      end

      it 'returns a SafeDeferrable that catches exceptions in callbacks and logs them' do
        expect(client.stats).to be_a(Ably::Util::SafeDeferrable)
        stop_reactor
      end
    end
  end
end

Version data entries

66 entries across 66 versions & 2 rubygems

Version Path
ably-rest-1.2.7 lib/submodules/ably-ruby/spec/acceptance/realtime/stats_spec.rb
ably-1.2.7 spec/acceptance/realtime/stats_spec.rb
ably-rest-1.2.6 lib/submodules/ably-ruby/spec/acceptance/realtime/stats_spec.rb
ably-1.2.6 spec/acceptance/realtime/stats_spec.rb
ably-rest-1.2.4 lib/submodules/ably-ruby/spec/acceptance/realtime/stats_spec.rb
ably-1.2.4 spec/acceptance/realtime/stats_spec.rb
ably-rest-1.2.3 lib/submodules/ably-ruby/spec/acceptance/realtime/stats_spec.rb
ably-1.2.3 spec/acceptance/realtime/stats_spec.rb
ably-rest-1.2.2 lib/submodules/ably-ruby/spec/acceptance/realtime/stats_spec.rb
ably-1.2.2 spec/acceptance/realtime/stats_spec.rb
ably-rest-1.2.1 lib/submodules/ably-ruby/spec/acceptance/realtime/stats_spec.rb
ably-1.2.1 spec/acceptance/realtime/stats_spec.rb
ably-rest-1.2.0 lib/submodules/ably-ruby/spec/acceptance/realtime/stats_spec.rb
ably-1.2.0 spec/acceptance/realtime/stats_spec.rb
ably-rest-1.1.8 lib/submodules/ably-ruby/spec/acceptance/realtime/stats_spec.rb
ably-1.1.8 spec/acceptance/realtime/stats_spec.rb
ably-rest-1.1.7 lib/submodules/ably-ruby/spec/acceptance/realtime/stats_spec.rb
ably-1.1.7 spec/acceptance/realtime/stats_spec.rb
ably-rest-1.1.6 lib/submodules/ably-ruby/spec/acceptance/realtime/stats_spec.rb
ably-1.1.6 spec/acceptance/realtime/stats_spec.rb