From b77313b84762b85aa8db79f796119c6d07a6a735 Mon Sep 17 00:00:00 2001 From: firelemons Date: Tue, 2 Jan 2024 18:16:20 -0600 Subject: [PATCH] fix test expecting dates out of range of a week --- app/controllers/health_controller.rb | 2 -- spec/requests/health_spec.rb | 4 ++-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/app/controllers/health_controller.rb b/app/controllers/health_controller.rb index 09c83a4cae..f8a5754cb5 100644 --- a/app/controllers/health_controller.rb +++ b/app/controllers/health_controller.rb @@ -23,8 +23,6 @@ def case_contacts_creation_times_in_last_week def monthly_line_graph_data first_day_of_last_12_months = (12.months.ago.to_date..Date.current).select { |date| date.day == 1 }.map { |date| date.beginning_of_month } - binding.pry - monthly_counts_of_case_contacts_created = CaseContact.group_by_month(:created_at, last: 12).count monthly_counts_of_case_contacts_with_notes_created = CaseContact.where("notes != ''").group_by_month(:created_at, last: 12).count monthly_counts_of_users_who_have_created_case_contacts = CaseContact.select(:creator_id).distinct.group_by_month(:created_at, last: 12).count diff --git a/spec/requests/health_spec.rb b/spec/requests/health_spec.rb index 3b6967bb74..c6cf94ab49 100644 --- a/spec/requests/health_spec.rb +++ b/spec/requests/health_spec.rb @@ -35,14 +35,14 @@ describe "GET #case_contacts_creation_times_in_last_week" do it "returns timestamps of case contacts created in the last week" do - case_contact1 = create(:case_contact, created_at: 1.week.ago) + case_contact1 = create(:case_contact, created_at: 6.days.ago) case_contact2 = create(:case_contact, created_at: 2.weeks.ago) get case_contacts_creation_times_in_last_week_health_index_path expect(response).to have_http_status(:ok) expect(response.content_type).to include("application/json") timestamps = JSON.parse(response.body)["timestamps"] expect(timestamps).to include(case_contact1.created_at.to_i) - expect(timestamps).not_to include(case_contact2.created_at.iso8601(3)) + expect(timestamps).not_to include(case_contact2.created_at.to_i) end end