diff --git a/spec/requests/providers_spec.rb b/spec/requests/providers_spec.rb index 9b5bc0d828..94c00263d9 100644 --- a/spec/requests/providers_spec.rb +++ b/spec/requests/providers_spec.rb @@ -1457,9 +1457,10 @@ def gen_import_request let(:provider) { FactoryBot.create(:ems_redhat) } let(:provider1) { FactoryBot.create(:ems_redhat) } let(:url) { api_provider_metric_rollups_url(nil, provider) } + let(:first_ts) { 1.hour.ago } before do - FactoryBot.create_list(:metric_rollup_cm_hr, 3, :resource => provider, :timestamp => 1.hour.ago) + FactoryBot.create_list(:metric_rollup_cm_hr, 3, :resource => provider, :timestamp => first_ts) FactoryBot.create_list(:metric_rollup_cm_daily, 1, :resource => provider) FactoryBot.create_list(:metric_rollup_cm_hr, 1, :resource => provider1) end @@ -1467,8 +1468,7 @@ def gen_import_request it 'returns the metric rollups for the provider' do api_basic_authorize subcollection_action_identifier(:providers, :metric_rollups, :read, :get) - provider.metric_rollups.where(:capture_interval_name => 'hourly').name - get(url, :params => { :capture_interval => 'hourly', :start_date => Time.zone.today.to_s }) + get(url, :params => { :capture_interval => 'hourly', :start_date => first_ts.to_date.to_s }) expected = { 'count' => 5, @@ -1483,7 +1483,7 @@ def gen_import_request it 'will not return metric rollups without an appropriate role' do api_basic_authorize - get(url, :params => { :capture_interval => 'hourly', :start_date => Time.zone.today.to_s }) + get(url, :params => { :capture_interval => 'hourly', :start_date => first_ts.to_date.to_s }) expect(response).to have_http_status(:forbidden) end