From a56f061663ba876be0ccd3063e141a100c247816 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Bellet Date: Tue, 14 Feb 2023 14:48:35 +0100 Subject: [PATCH] Prepare the spec to be factorized and to be used in different context --- spec/system/consumer/footer_links_spec.rb | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/spec/system/consumer/footer_links_spec.rb b/spec/system/consumer/footer_links_spec.rb index 4685b09895..0ffb86c133 100644 --- a/spec/system/consumer/footer_links_spec.rb +++ b/spec/system/consumer/footer_links_spec.rb @@ -9,13 +9,22 @@ describe "Footer Links" do expect(page).to have_link "cookies policy" end - it "opens cookies policy page" do - visit root_path - click_link "cookies policy" - within "div.reveal-modal" do - expect(page).to have_content "How We Use Cookies" + shared_examples "opens the cookie policy modal" do |content| + it "with the right content" do + within "div.reveal-modal" do + expect(page).to have_content content + end end end + + context "when english is the default language" do + before do + visit root_path + click_link "cookies policy" + end + + it_behaves_like "opens the cookie policy modal", "How We Use Cookies" + end end describe "privacy policy link" do