Skip to content

Commit

Permalink
fix test expecting dates out of range of a week
Browse files Browse the repository at this point in the history
  • Loading branch information
FireLemons committed Jan 3, 2024
1 parent 4fd90d8 commit b77313b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
2 changes: 0 additions & 2 deletions app/controllers/health_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions spec/requests/health_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit b77313b

Please sign in to comment.