From adc5906253631c5354d9da5635b2eafb3ae1c13b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Sat, 22 Jun 2019 21:56:57 +0200 Subject: [PATCH] Apply `Rails/PluralizationGrammar` rubocop rule --- .rubocop.yml | 3 --- .rubocop_basic.yml | 3 +++ spec/features/admin/budget_phases_spec.rb | 4 ++-- spec/features/admin/legislation/processes_spec.rb | 2 +- spec/features/legislation/resume_spec.rb | 14 +++++++------- spec/models/debate_spec.rb | 2 +- spec/models/legislation/people_proposals_spec.rb | 2 +- spec/models/legislation/proposal_spec.rb | 4 ++-- spec/models/proposal_spec.rb | 2 +- 9 files changed, 18 insertions(+), 18 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index cf9fb516e..7b50034aa 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -141,9 +141,6 @@ Rails/Output: Rails/OutputSafety: Enabled: true -Rails/PluralizationGrammar: - Enabled: true - Rails/Presence: Enabled: true diff --git a/.rubocop_basic.yml b/.rubocop_basic.yml index 62496d567..081bc2be0 100644 --- a/.rubocop_basic.yml +++ b/.rubocop_basic.yml @@ -129,6 +129,9 @@ Rails/Date: Rails/HttpPositionalArguments: Enabled: true +Rails/PluralizationGrammar: + Enabled: true + Rails/RelativeDateConstant: Enabled: true diff --git a/spec/features/admin/budget_phases_spec.rb b/spec/features/admin/budget_phases_spec.rb index 142bc7f02..fa1a4031d 100644 --- a/spec/features/admin/budget_phases_spec.rb +++ b/spec/features/admin/budget_phases_spec.rb @@ -19,7 +19,7 @@ describe "Admin budget phases" do scenario "Update phase", :js do visit edit_admin_budget_budget_phase_path(budget, budget.current_phase) - fill_in "start_date", with: Date.current + 1.days + fill_in "start_date", with: Date.current + 1.day fill_in "end_date", with: Date.current + 12.days fill_in_translatable_ckeditor "summary", :en, with: "New summary of the phase." fill_in_translatable_ckeditor "description", :en, with: "New description of the phase." @@ -29,7 +29,7 @@ describe "Admin budget phases" do expect(page).to have_current_path(edit_admin_budget_path(budget)) expect(page).to have_content "Changes saved" - expect(budget.current_phase.starts_at.to_date).to eq((Date.current + 1.days).to_date) + expect(budget.current_phase.starts_at.to_date).to eq((Date.current + 1.day).to_date) expect(budget.current_phase.ends_at.to_date).to eq((Date.current + 12.days).to_date) expect(budget.current_phase.summary).to include("New summary of the phase.") expect(budget.current_phase.description).to include("New description of the phase.") diff --git a/spec/features/admin/legislation/processes_spec.rb b/spec/features/admin/legislation/processes_spec.rb index 056202584..138f989c4 100644 --- a/spec/features/admin/legislation/processes_spec.rb +++ b/spec/features/admin/legislation/processes_spec.rb @@ -97,7 +97,7 @@ describe "Admin collaborative legislation" do fill_in "legislation_process[draft_start_date]", with: (base_date - 3.days).strftime("%d/%m/%Y") fill_in "legislation_process[draft_end_date]", - with: (base_date - 1.days).strftime("%d/%m/%Y") + with: (base_date - 1.day).strftime("%d/%m/%Y") fill_in "legislation_process[draft_publication_date]", with: (base_date + 3.days).strftime("%d/%m/%Y") fill_in "legislation_process[allegations_start_date]", diff --git a/spec/features/legislation/resume_spec.rb b/spec/features/legislation/resume_spec.rb index 749826980..643fe17c7 100644 --- a/spec/features/legislation/resume_spec.rb +++ b/spec/features/legislation/resume_spec.rb @@ -18,7 +18,7 @@ describe "Legislation" do context "process empty" do before do - @process = create(:legislation_process, :empty, end_date: Date.current - 1.days) + @process = create(:legislation_process, :empty, end_date: Date.current - 1.day) end scenario "warning empty" do @@ -29,7 +29,7 @@ describe "Legislation" do context "phases empty" do before do - @process = create(:legislation_process, end_date: Date.current - 1.days) + @process = create(:legislation_process, end_date: Date.current - 1.day) end scenario "debates empty" do @@ -56,7 +56,7 @@ describe "Legislation" do context "process empty" do before do - @process = create(:legislation_process, :empty, end_date: Date.current - 1.days) + @process = create(:legislation_process, :empty, end_date: Date.current - 1.day) end scenario "warning empty" do @@ -68,7 +68,7 @@ describe "Legislation" do context "only debates exist" do before do user = create(:user, :level_two) - @process = create(:legislation_process, end_date: Date.current - 1.days) + @process = create(:legislation_process, end_date: Date.current - 1.day) @debate = create(:legislation_question, process: @process, title: "Question 1") create(:debate_comment, user: user, commentable_id: @debate.id, body: "Answer 1") create(:debate_comment, user: user, commentable_id: @debate.id, body: "Answer 2") @@ -123,7 +123,7 @@ describe "Legislation" do context "only proposals exist" do before do - @process = create(:legislation_process, end_date: Date.current - 1.days) + @process = create(:legislation_process, end_date: Date.current - 1.day) create(:legislation_proposal, legislation_process_id: @process.id, title: "Legislation proposal 1", selected: true) create(:legislation_proposal, legislation_process_id: @process.id, @@ -171,7 +171,7 @@ describe "Legislation" do context "only text comments exist" do before do user = create(:user, :level_two) - @process = create(:legislation_process, end_date: Date.current - 1.days) + @process = create(:legislation_process, end_date: Date.current - 1.day) draft_version_1 = create(:legislation_draft_version, process: @process, title: "Version 1", body: "Body of the first version", status: "published") @@ -231,7 +231,7 @@ describe "Legislation" do describe Legislation::ProcessesController, type: :controller do before do user = create(:user, :level_two) - @process = create(:legislation_process, end_date: Date.current - 1.days) + @process = create(:legislation_process, end_date: Date.current - 1.day) @debate = create(:legislation_question, process: @process, title: "Question 1") create(:debate_comment, user: user, commentable_id: @debate.id, body: "Answer 1") create(:debate_comment, user: user, commentable_id: @debate.id, body: "Answer 2") diff --git a/spec/models/debate_spec.rb b/spec/models/debate_spec.rb index 2afd2f3c9..ecba4d46f 100644 --- a/spec/models/debate_spec.rb +++ b/spec/models/debate_spec.rb @@ -240,7 +240,7 @@ describe Debate do it "remains the same for not voted debates" do new = create(:debate, created_at: now) old = create(:debate, created_at: 1.day.ago) - older = create(:debate, created_at: 2.month.ago) + older = create(:debate, created_at: 2.months.ago) expect(new.hot_score).to be 0 expect(old.hot_score).to be 0 expect(older.hot_score).to be 0 diff --git a/spec/models/legislation/people_proposals_spec.rb b/spec/models/legislation/people_proposals_spec.rb index c1aef7571..0dd0a577a 100644 --- a/spec/models/legislation/people_proposals_spec.rb +++ b/spec/models/legislation/people_proposals_spec.rb @@ -47,7 +47,7 @@ describe Legislation::PeopleProposal do it "remains the same for not voted people_proposals" do new = create(:legislation_people_proposal, created_at: now) old = create(:legislation_people_proposal, created_at: 1.day.ago) - older = create(:legislation_people_proposal, created_at: 2.month.ago) + older = create(:legislation_people_proposal, created_at: 2.months.ago) expect(new.hot_score).to be 0 expect(old.hot_score).to be 0 expect(older.hot_score).to be 0 diff --git a/spec/models/legislation/proposal_spec.rb b/spec/models/legislation/proposal_spec.rb index f2f72b055..2959a7a5f 100644 --- a/spec/models/legislation/proposal_spec.rb +++ b/spec/models/legislation/proposal_spec.rb @@ -47,7 +47,7 @@ describe Legislation::Proposal do it "remains the same for not voted proposals" do new = create(:legislation_proposal, created_at: now) old = create(:legislation_proposal, created_at: 1.day.ago) - older = create(:legislation_proposal, created_at: 2.month.ago) + older = create(:legislation_proposal, created_at: 2.months.ago) expect(new.hot_score).to be 0 expect(old.hot_score).to be 0 expect(older.hot_score).to be 0 @@ -67,7 +67,7 @@ describe Legislation::Proposal do newer_proposal = create(:legislation_proposal, created_at: now) 5.times { newer_proposal.vote_by(voter: create(:user), vote: "yes") } - older_proposal = create(:legislation_proposal, created_at: 2.day.ago) + older_proposal = create(:legislation_proposal, created_at: 2.days.ago) 5.times { older_proposal.vote_by(voter: create(:user), vote: "yes") } expect(newer_proposal.hot_score).to be > older_proposal.hot_score diff --git a/spec/models/proposal_spec.rb b/spec/models/proposal_spec.rb index 17fe65682..ddaee48dc 100644 --- a/spec/models/proposal_spec.rb +++ b/spec/models/proposal_spec.rb @@ -285,7 +285,7 @@ describe Proposal do it "remains the same for not voted proposals" do new = create(:proposal, created_at: now) old = create(:proposal, created_at: 1.day.ago) - older = create(:proposal, created_at: 2.month.ago) + older = create(:proposal, created_at: 2.months.ago) expect(new.hot_score).to be 0 expect(old.hot_score).to be 0 expect(older.hot_score).to be 0