spec/acceptance/rest/stats_spec.rb in ably-0.7.6 vs spec/acceptance/rest/stats_spec.rb in ably-0.8.0
- old
+ new
@@ -42,11 +42,11 @@
context 'by minute' do
let(:first_inbound_realtime_count) { STATS_FIXTURES.first[:inbound][:realtime][:messages][:count] }
let(:last_inbound_realtime_count) { STATS_FIXTURES.last[:inbound][:realtime][:messages][:count] }
context 'with :from set to last interval and :limit set to 1' do
- let(:subject) { client.stats(start: as_since_epoch(LAST_INTERVAL), by: :minute, limit: 1) }
+ let(:subject) { client.stats(start: as_since_epoch(LAST_INTERVAL), end: LAST_INTERVAL, unit: :minute, limit: 1) }
let(:stat) { subject.items.first }
it 'retrieves only one stat' do
expect(subject.items.count).to eql(1)
end
@@ -114,11 +114,11 @@
end
end
context 'with :start set to first interval, :limit set to 1 and direction :forwards' do
let(:first_interval) { LAST_INTERVAL - 120 }
- let(:subject) { client.stats(start: as_since_epoch(first_interval), by: :minute, direction: :forwards, limit: 1) }
+ let(:subject) { client.stats(start: as_since_epoch(first_interval), end: LAST_INTERVAL, unit: :minute, direction: :forwards, limit: 1) }
let(:stat) { subject.items.first }
it 'returns the first interval stats as stats are provided forwards from :start' do
expect(stat.inbound.realtime.all.count).to eql(first_inbound_realtime_count)
end
@@ -131,11 +131,11 @@
expect(page3.items.first.inbound.realtime.all.count).to eql(last_inbound_realtime_count)
end
end
context 'with :end set to last interval, :limit set to 1 and direction :backwards' do
- let(:subject) { client.stats(:end => as_since_epoch(LAST_INTERVAL), by: :minute, direction: :backwards, limit: 1) }
+ let(:subject) { client.stats(:end => as_since_epoch(LAST_INTERVAL), end: LAST_INTERVAL, unit: :minute, direction: :backwards, limit: 1) }
let(:stat) { subject.items.first }
it 'returns the 3rd interval stats first as stats are provided backwards from :end' do
expect(stat.inbound.realtime.all.count).to eql(last_inbound_realtime_count)
end
@@ -149,10 +149,10 @@
end
end
[:hour, :day, :month].each do |interval|
context "by #{interval}" do
- let(:subject) { client.stats(start: as_since_epoch(LAST_INTERVAL), by: interval, direction: 'forwards', limit: 1) }
+ let(:subject) { client.stats(start: as_since_epoch(LAST_INTERVAL), end: LAST_INTERVAL, unit: interval, direction: 'forwards', limit: 1) }
let(:stat) { subject.items.first }
let(:aggregate_messages_count) do
STATS_FIXTURES.inject(0) do |sum, fixture|
sum + fixture[:inbound][:realtime][:messages][:count] + fixture[:outbound][:realtime][:messages][:count]
end