From 3752fef6bf9933f8980d3928c2e35dd6e3225c2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Mon, 6 Sep 2021 15:27:02 +0200 Subject: [PATCH] Remove map page in debates The map feature was never implemented for debates (only for proposals and budget investments) and it was crashing for debates because the page didn't load the geozones. And we don't have a "geozone" field in the debates form either. So we're removing the map page alongside its (pending implementation) tests. --- app/controllers/debates_controller.rb | 2 +- app/views/debates/map.html.erb | 1 - config/routes/debate.rb | 1 - spec/models/tag_cloud_spec.rb | 1 - spec/system/debates_spec.rb | 63 --------------------------- 5 files changed, 1 insertion(+), 67 deletions(-) delete mode 100644 app/views/debates/map.html.erb diff --git a/app/controllers/debates_controller.rb b/app/controllers/debates_controller.rb index df92c3a5e..2bd4cde03 100644 --- a/app/controllers/debates_controller.rb +++ b/app/controllers/debates_controller.rb @@ -4,7 +4,7 @@ class DebatesController < ApplicationController include FlagActions include Translatable - before_action :authenticate_user!, except: [:index, :show, :map] + before_action :authenticate_user!, except: [:index, :show] before_action :set_view, only: :index before_action :debates_recommendations, only: :index, if: :current_user diff --git a/app/views/debates/map.html.erb b/app/views/debates/map.html.erb deleted file mode 100644 index d3aee6ef8..000000000 --- a/app/views/debates/map.html.erb +++ /dev/null @@ -1 +0,0 @@ -<%= render "shared/map", new_url_path: new_debate_path %> diff --git a/config/routes/debate.rb b/config/routes/debate.rb index eeb3b6afe..58f1f9215 100644 --- a/config/routes/debate.rb +++ b/config/routes/debate.rb @@ -8,7 +8,6 @@ resources :debates do end collection do - get :map get :suggest put "recommendations/disable", only: :index, controller: "debates", action: :disable_recommendations end diff --git a/spec/models/tag_cloud_spec.rb b/spec/models/tag_cloud_spec.rb index 8102ae5d4..dbc2fcbf4 100644 --- a/spec/models/tag_cloud_spec.rb +++ b/spec/models/tag_cloud_spec.rb @@ -87,7 +87,6 @@ describe TagCloud do end xit "returns tags scoped by category for debates" - xit "returns tags scoped by geozone for debates" it "orders tags by count" do 3.times { create(:proposal, tag_list: "participation") } diff --git a/spec/system/debates_spec.rb b/spec/system/debates_spec.rb index 3272b82e0..e56e77c9f 100644 --- a/spec/system/debates_spec.rb +++ b/spec/system/debates_spec.rb @@ -668,69 +668,6 @@ describe "Debates" do expect(page).to have_content("User deleted") end - context "Filter" do - context "By geozone" do - let(:california) { Geozone.create(name: "California") } - let(:new_york) { Geozone.create(name: "New York") } - - before do - create(:debate, geozone: california, title: "Bigger sequoias") - create(:debate, geozone: california, title: "Green beach") - create(:debate, geozone: new_york, title: "Sully monument") - end - - pending "From map" do - visit debates_path - - click_link "map" - within("#html_map") do - url = find("area[title='California']")[:href] - visit url - end - - within("#debates") do - expect(page).to have_css(".debate", count: 2) - expect(page).to have_content("Bigger sequoias") - expect(page).to have_content("Green beach") - expect(page).not_to have_content("Sully monument") - end - end - - pending "From geozone list" do - visit debates_path - - click_link "map" - within("#geozones") do - click_link "California" - end - within("#debates") do - expect(page).to have_css(".debate", count: 2) - expect(page).to have_content("Bigger sequoias") - expect(page).to have_content("Green beach") - expect(page).not_to have_content("Sully monument") - end - end - - pending "From debate" do - debate = create(:debate, geozone: california, title: "Surf college") - - visit debate_path(debate) - - within("#geozone") do - click_link "California" - end - - within("#debates") do - expect(page).to have_css(".debate", count: 3) - expect(page).to have_content("Surf college") - expect(page).to have_content("Bigger sequoias") - expect(page).to have_content("Green beach") - expect(page).not_to have_content("Sully monument") - end - end - end - end - context "Suggesting debates" do scenario "Shows up to 5 suggestions" do create(:debate, title: "First debate has 1 vote", cached_votes_up: 1)