spec/integration/lib/auth0/api/v2/api_stats_spec.rb in auth0-4.5.0 vs spec/integration/lib/auth0/api/v2/api_stats_spec.rb in auth0-4.6.0

- old
+ new

@@ -1,25 +1,22 @@ require 'spec_helper' describe Auth0::Api::V2::Stats do let(:client) { Auth0Client.new(v2_creds) } - describe '.active_users' do - it do - sleep 1 + describe '.active_users', vcr: true do + it 'should have at least one active user' do expect(Integer(client.active_users)).to be >= 0 end end # rubocop:disable Date - describe '.daily_stats' do - let(:from) { Date.today.prev_day.strftime('%Y%m%d') } - let(:to) { Date.today.strftime('%Y%m%d') } - let(:daily_stats) do - sleep 1 - client.daily_stats(from, to) + describe '.daily_stats', vcr: true do + it 'should have at least one stats entry for the timeframe' do + expect( + client.daily_stats( + Date.new(2017, 1, 1).strftime('%Y%m%d'), + Date.new(2018, 1, 1).strftime('%Y%m%d') + ).size + ).to be > 0 end - it do - sleep 1 - expect(daily_stats.size).to be > 0 - end end -end +end \ No newline at end of file