Remove legislation processes next filter
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
class Admin::Legislation::ProcessesController < Admin::Legislation::BaseController
|
||||
include Translatable
|
||||
|
||||
has_filters %w{open next past all}, only: :index
|
||||
has_filters %w[open past all], only: :index
|
||||
|
||||
load_and_authorize_resource :process, class: "Legislation::Process"
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
class Legislation::ProcessesController < Legislation::BaseController
|
||||
has_filters %w[open next past], only: :index
|
||||
has_filters %w[open past], only: :index
|
||||
has_filters %w[random winners], only: :proposals
|
||||
|
||||
load_and_authorize_resource
|
||||
|
||||
@@ -50,7 +50,6 @@ class Legislation::Process < ActiveRecord::Base
|
||||
validates :font_color, format: { allow_blank: true, with: CSS_HEX_COLOR }
|
||||
|
||||
scope :open, -> { where("start_date <= ? and end_date >= ?", Date.current, Date.current) }
|
||||
scope :next, -> { where("start_date > ?", Date.current) }
|
||||
scope :past, -> { where("end_date < ?", Date.current) }
|
||||
|
||||
scope :published, -> { where(published: true) }
|
||||
|
||||
@@ -446,7 +446,6 @@ en:
|
||||
title: Legislation processes
|
||||
filters:
|
||||
open: Open
|
||||
next: Next
|
||||
past: Past
|
||||
all: All
|
||||
new:
|
||||
|
||||
@@ -62,10 +62,8 @@ en:
|
||||
filter: Filter
|
||||
filters:
|
||||
open: Open processes
|
||||
next: Next
|
||||
past: Past
|
||||
no_open_processes: There aren't open processes
|
||||
no_next_processes: There aren't planned processes
|
||||
no_past_processes: There aren't past processes
|
||||
section_header:
|
||||
icon_alt: Legislation processes icon
|
||||
|
||||
@@ -447,7 +447,6 @@ es:
|
||||
title: Procesos de legislación colaborativa
|
||||
filters:
|
||||
open: Abiertos
|
||||
next: Próximamente
|
||||
past: Pasados
|
||||
all: Todos
|
||||
new:
|
||||
|
||||
@@ -62,10 +62,8 @@ es:
|
||||
filter: Filtro
|
||||
filters:
|
||||
open: Procesos activos
|
||||
next: Próximamente
|
||||
past: Terminados
|
||||
no_open_processes: No hay procesos activos
|
||||
no_next_processes: No hay procesos planeados
|
||||
no_past_processes: No hay procesos terminados
|
||||
section_header:
|
||||
icon_alt: Icono de Procesos legislativos
|
||||
|
||||
@@ -34,17 +34,6 @@ FactoryBot.define do
|
||||
result_publication_enabled true
|
||||
published true
|
||||
|
||||
trait :next do
|
||||
start_date { Date.current + 2.days }
|
||||
end_date { Date.current + 8.days }
|
||||
debate_start_date { Date.current + 2.days }
|
||||
debate_end_date { Date.current + 4.days }
|
||||
draft_publication_date { Date.current + 5.days }
|
||||
allegations_start_date { Date.current + 5.days }
|
||||
allegations_end_date { Date.current + 7.days }
|
||||
result_publication_date { Date.current + 8.days }
|
||||
end
|
||||
|
||||
trait :past do
|
||||
start_date { Date.current - 12.days }
|
||||
end_date { Date.current - 2.days }
|
||||
|
||||
@@ -26,15 +26,9 @@ feature 'Legislation' do
|
||||
|
||||
context 'processes home page' do
|
||||
|
||||
scenario 'No processes to be listed' do
|
||||
scenario "No processes to be listed" do
|
||||
visit legislation_processes_path
|
||||
expect(page).to have_text "There aren't open processes"
|
||||
|
||||
visit legislation_processes_path(filter: 'next')
|
||||
expect(page).to have_text "There aren't planned processes"
|
||||
|
||||
visit legislation_processes_path(filter: 'past')
|
||||
expect(page).to have_text "There aren't past processes"
|
||||
end
|
||||
|
||||
scenario 'Processes can be listed' do
|
||||
@@ -90,24 +84,16 @@ feature 'Legislation' do
|
||||
|
||||
scenario 'Filtering processes' do
|
||||
create(:legislation_process, title: "Process open")
|
||||
create(:legislation_process, :next, title: "Process next")
|
||||
create(:legislation_process, :past, title: "Process past")
|
||||
create(:legislation_process, :in_draft_phase, title: "Process in draft phase")
|
||||
|
||||
visit legislation_processes_path
|
||||
expect(page).to have_content('Process open')
|
||||
expect(page).not_to have_content('Process next')
|
||||
expect(page).not_to have_content('Process past')
|
||||
expect(page).not_to have_content('Process in draft phase')
|
||||
|
||||
visit legislation_processes_path(filter: 'next')
|
||||
expect(page).not_to have_content('Process open')
|
||||
expect(page).to have_content('Process next')
|
||||
expect(page).not_to have_content('Process past')
|
||||
|
||||
visit legislation_processes_path(filter: 'past')
|
||||
expect(page).not_to have_content('Process open')
|
||||
expect(page).not_to have_content('Process next')
|
||||
expect(page).to have_content('Process past')
|
||||
end
|
||||
|
||||
@@ -115,10 +101,8 @@ feature 'Legislation' do
|
||||
before do
|
||||
create(:legislation_process, title: "published")
|
||||
create(:legislation_process, :not_published, title: "not published")
|
||||
[:next, :past].each do |trait|
|
||||
create(:legislation_process, trait, title: "#{trait} published")
|
||||
create(:legislation_process, :not_published, trait, title: "#{trait} not published")
|
||||
end
|
||||
create(:legislation_process, :past, title: "past published")
|
||||
create(:legislation_process, :not_published, :past, title: "past not published")
|
||||
end
|
||||
|
||||
it "aren't listed" do
|
||||
@@ -132,17 +116,6 @@ feature 'Legislation' do
|
||||
expect(page).to have_content('published')
|
||||
end
|
||||
|
||||
it "aren't listed with next filter" do
|
||||
visit legislation_processes_path(filter: 'next')
|
||||
expect(page).not_to have_content('not published')
|
||||
expect(page).to have_content('next published')
|
||||
|
||||
login_as(administrator)
|
||||
visit legislation_processes_path(filter: 'next')
|
||||
expect(page).not_to have_content('not published')
|
||||
expect(page).to have_content('next published')
|
||||
end
|
||||
|
||||
it "aren't listed with past filter" do
|
||||
visit legislation_processes_path(filter: 'past')
|
||||
expect(page).not_to have_content('not published')
|
||||
|
||||
@@ -144,14 +144,6 @@ describe Legislation::Process do
|
||||
expect(processes_not_in_draft).not_to include(process_with_draft_only_today)
|
||||
end
|
||||
|
||||
it "filters next" do
|
||||
next_processes = ::Legislation::Process.next
|
||||
|
||||
expect(next_processes).to include(process_2)
|
||||
expect(next_processes).not_to include(process_1)
|
||||
expect(next_processes).not_to include(process_3)
|
||||
end
|
||||
|
||||
it "filters past" do
|
||||
past_processes = ::Legislation::Process.past
|
||||
|
||||
|
||||
Reference in New Issue
Block a user