diff --git a/app/views/layouts/_header.html.erb b/app/views/layouts/_header.html.erb
index 346582e84..d11c57fe4 100644
--- a/app/views/layouts/_header.html.erb
+++ b/app/views/layouts/_header.html.erb
@@ -16,8 +16,10 @@
-
- <%= t("application.menu") %>
+
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index 9bff58db0..b24cd6902 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -98,6 +98,15 @@ RSpec.configure do |config|
Delayed::Worker.delay_jobs = false
end
+ config.before(:each, :small_window) do
+ @window_size = Capybara.current_window.size
+ Capybara.current_window.resize_to(639, 479)
+ end
+
+ config.after(:each, :small_window) do
+ Capybara.current_window.resize_to(*@window_size)
+ end
+
config.before(:each, :remote_translations) do
allow(RemoteTranslations::Microsoft::AvailableLocales)
.to receive(:available_locales).and_return(I18n.available_locales.map(&:to_s))
diff --git a/spec/system/admin_spec.rb b/spec/system/admin_spec.rb
index 3f115c7dc..88e8000da 100644
--- a/spec/system/admin_spec.rb
+++ b/spec/system/admin_spec.rb
@@ -104,4 +104,22 @@ describe "Admin" do
expect(page).to have_link "Participatory budgets"
end
end
+
+ describe "Menu button", :admin do
+ scenario "is not present on large screens" do
+ visit admin_root_path
+
+ expect(page).not_to have_button "Menu"
+ end
+
+ scenario "toggles the menu on small screens", :small_window do
+ visit admin_root_path
+
+ expect(page).not_to have_link "My account"
+
+ click_button "Menu"
+
+ expect(page).to have_link "My account"
+ end
+ end
end
diff --git a/spec/system/debates_spec.rb b/spec/system/debates_spec.rb
index b7714387c..217af3655 100644
--- a/spec/system/debates_spec.rb
+++ b/spec/system/debates_spec.rb
@@ -103,17 +103,7 @@ describe "Debates" do
end
end
- context "On small devices" do
- let!(:window_size) { Capybara.current_window.size }
-
- before do
- Capybara.current_window.resize_to(639, 479)
- end
-
- after do
- Capybara.current_window.resize_to(*window_size)
- end
-
+ context "On small devices", :small_window do
scenario "Shows links to share on telegram and whatsapp too" do
visit debate_path(create(:debate))
diff --git a/spec/system/home_spec.rb b/spec/system/home_spec.rb
index 0cacb822b..f1482e2d9 100644
--- a/spec/system/home_spec.rb
+++ b/spec/system/home_spec.rb
@@ -138,6 +138,24 @@ describe "Home" do
end
end
+ describe "Menu button" do
+ scenario "is not present on large screens" do
+ visit root_path
+
+ expect(page).not_to have_button "Menu"
+ end
+
+ scenario "toggles the menu on small screens", :small_window do
+ visit root_path
+
+ expect(page).not_to have_link "Sign in"
+
+ click_button "Menu"
+
+ expect(page).to have_link "Sign in"
+ end
+ end
+
scenario "if there are cards, the 'featured' title will render" do
create(:widget_card,
title: "Card text",
diff --git a/spec/system/proposals_spec.rb b/spec/system/proposals_spec.rb
index 0b104ea8a..172adfe5d 100644
--- a/spec/system/proposals_spec.rb
+++ b/spec/system/proposals_spec.rb
@@ -148,17 +148,7 @@ describe "Proposals" do
end
end
- context "On small devices" do
- let!(:window_size) { Capybara.current_window.size }
-
- before do
- Capybara.current_window.resize_to(639, 479)
- end
-
- after do
- Capybara.current_window.resize_to(*window_size)
- end
-
+ context "On small devices", :small_window do
scenario "Shows links to share on telegram and whatsapp too" do
visit proposal_path(create(:proposal))
@@ -253,17 +243,7 @@ describe "Proposals" do
end
end
- describe "Show sticky support button on mobile screens" do
- let!(:window_size) { Capybara.current_window.size }
-
- before do
- Capybara.current_window.resize_to(640, 480)
- end
-
- after do
- Capybara.current_window.resize_to(*window_size)
- end
-
+ describe "Show sticky support button on small screens", :small_window do
scenario "On a first visit" do
proposal = create(:proposal)
visit proposal_path(proposal)