Skip to content

Commit 760eea4

Browse files
committed
flaky specs
1 parent 46504b1 commit 760eea4

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

spec/system/volunteers/index_spec.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,7 @@
371371
end
372372

373373
it "can show/hide columns on volunteers table", js: true do
374+
travel_back
374375
sign_in supervisor
375376

376377
visit volunteers_path

spec/views/notifications/index.html.erb_spec.rb

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
require "rails_helper"
22

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

1716
before do
18-
assign(:notifications, Noticed::Notification.all)
17+
assign(:notifications, Noticed::Notification.all.newest_first)
1918
assign(:patch_notes, PatchNote.all)
2019
assign(:deploy_time, deploy_time)
2120
end
2221

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

2625
before do
2726
Health.instance.update_attribute(:latest_deploy_time, deploy_time)
2827
end
2928

3029
context "when there are notifications" do
3130
before do
32-
notification_1_hour_ago.update_attribute(:created_at, base_time - 1.hour)
33-
notification_1_day_ago.update_attribute(:created_at, base_time - 1.day)
34-
notification_2_days_ago.update_attribute(:created_at, base_time - 2.days)
35-
notification_3_days_ago.update_attribute(:created_at, base_time - 3.days)
31+
notification_1_hour_ago.update!(created_at: 1.hour.ago)
32+
notification_1_day_ago.update!(created_at: 1.day.ago)
33+
notification_2_days_ago.update!(created_at: 2.days.ago)
34+
notification_3_days_ago.update!(created_at: 3.days.ago)
3635

37-
patch_note_1.update_attribute(:patch_note_group, patch_note_group_all_users)
36+
patch_note_1.update!(patch_note_group: patch_note_group_all_users)
3837
end
3938

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

0 commit comments

Comments
 (0)