Skip to content

Commit

Permalink
flaky specs
Browse files Browse the repository at this point in the history
  • Loading branch information
thejonroberts committed Nov 10, 2024
1 parent 46504b1 commit 760eea4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
1 change: 1 addition & 0 deletions spec/system/volunteers/index_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,7 @@
end

it "can show/hide columns on volunteers table", js: true do
travel_back
sign_in supervisor

visit volunteers_path
Expand Down
15 changes: 7 additions & 8 deletions spec/views/notifications/index.html.erb_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
require "rails_helper"

RSpec.describe "notifications/index", type: :view do
let(:base_time) { Date.new(2025, 1, 2) }
let(:notification_1_hour_ago) { create(:notification, :followup_with_note) }
let(:notification_1_day_ago) { create(:notification, :emancipation_checklist_reminder) }
let(:notification_2_days_ago) { create(:notification, :youth_birthday) }
Expand All @@ -15,26 +14,26 @@
let(:patch_note_2) { create(:patch_note, note: "Patch Note B", patch_note_type: patch_note_type_b) }

before do
assign(:notifications, Noticed::Notification.all)
assign(:notifications, Noticed::Notification.all.newest_first)
assign(:patch_notes, PatchNote.all)
assign(:deploy_time, deploy_time)
end

context "when there is a deploy date" do
let(:deploy_time) { base_time - 2.days }
let(:deploy_time) { 2.days.ago }

before do
Health.instance.update_attribute(:latest_deploy_time, deploy_time)
end

context "when there are notifications" do
before do
notification_1_hour_ago.update_attribute(:created_at, base_time - 1.hour)
notification_1_day_ago.update_attribute(:created_at, base_time - 1.day)
notification_2_days_ago.update_attribute(:created_at, base_time - 2.days)
notification_3_days_ago.update_attribute(:created_at, base_time - 3.days)
notification_1_hour_ago.update!(created_at: 1.hour.ago)
notification_1_day_ago.update!(created_at: 1.day.ago)
notification_2_days_ago.update!(created_at: 2.days.ago)
notification_3_days_ago.update!(created_at: 3.days.ago)

patch_note_1.update_attribute(:patch_note_group, patch_note_group_all_users)
patch_note_1.update!(patch_note_group: patch_note_group_all_users)
end

it "has all notifications created after and including the deploy date above the patch note" do
Expand Down

0 comments on commit 760eea4

Please sign in to comment.