Skip to content

Commit e5b8443

Browse files
authored
Merge pull request #2575 from mroderick/fix/flaky-homepage-test
fix(test): wrap flaky homepage tests in travel_to blocks
2 parents 3b7170e + 615fd99 commit e5b8443

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

spec/features/visiting_homepage_spec.rb

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
let!(:next_workshop) { Fabricate(:workshop) }
33
let!(:events) { Fabricate.times(3, :event) }
44

5-
before(:each) do
5+
before do
66
visit root_path
77
end
88

@@ -11,11 +11,15 @@
1111
end
1212

1313
scenario 'i can view the next workshop' do
14-
expect(page).to have_content "Workshop at #{next_workshop.host.name}"
14+
travel_to(Time.current) do
15+
expect(page).to have_content "Workshop at #{next_workshop.host.name}"
16+
end
1517
end
1618

1719
scenario 'i can view the next 5 upcoming events' do
18-
events.take(5).each { |event| expect(page).to have_content "#{event.name} at #{event.venue.name}" }
20+
travel_to(Time.current) do
21+
events.take(5).each { |event| expect(page).to have_content "#{event.name} at #{event.venue.name}" }
22+
end
1923
end
2024

2125
scenario 'i can access the code of conduct' do
@@ -37,7 +41,7 @@
3741
end
3842

3943
inactive_chapters.each do |chapter|
40-
expect(page).to_not have_content(chapter.name)
44+
expect(page).not_to have_content(chapter.name)
4145
end
4246
end
4347

0 commit comments

Comments
 (0)