From 94fb1397f0a37cc5fb5936d644783fc96b877002 Mon Sep 17 00:00:00 2001 From: Gaetan Craig-Riou Date: Fri, 10 Nov 2023 17:33:20 +1100 Subject: [PATCH] Set up data to hide ToS banner The banner can in some case overlap element we are trying to interact with. Add a fake ToS file and make sure user have accepted the ToS, so that the banner is not shown --- spec/factories/user_factory.rb | 1 + spec/system_helper.rb | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/spec/factories/user_factory.rb b/spec/factories/user_factory.rb index 8a5d7b4c3d..80b2ceca10 100644 --- a/spec/factories/user_factory.rb +++ b/spec/factories/user_factory.rb @@ -22,6 +22,7 @@ FactoryBot.define do confirmation_sent_at { '1970-01-01 00:00:00' } confirmed_at { '1970-01-01 00:00:01' } + terms_of_service_accepted_at { 1.hour.ago } before(:create) do |user, evaluator| if evaluator.confirmation_sent_at diff --git a/spec/system_helper.rb b/spec/system_helper.rb index 4af20f4f56..1b70ce8474 100644 --- a/spec/system_helper.rb +++ b/spec/system_helper.rb @@ -2,5 +2,12 @@ require "base_spec_helper" +RSpec.configure do |config| + # Set up a fake ToS file + config.before(:each, type: :system) do + allow(TermsOfServiceFile).to receive(:updated_at).and_return(2.hours.ago) + end +end + # system/support/ files contain system tests configurations and helpers Dir[File.join(__dir__, "system/support/**/*.rb")].sort.each { |file| require file }