spec/acceptance/realtime/stats_spec.rb in ably-0.8.2 vs spec/acceptance/realtime/stats_spec.rb in ably-0.8.3
- old
+ new
@@ -5,13 +5,25 @@
let(:client) do
Ably::Realtime::Client.new(key: api_key, environment: environment, protocol: protocol)
end
describe 'fetching stats' do
- it 'should return a PaginatedResult' 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)