From 13793d89c32fd1fe695038c71ef37efed07a93cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Wed, 23 Oct 2019 17:23:53 +0200 Subject: [PATCH 1/5] Fix extra parameter in `have_link` The second parameter was ignored. Besides, we changed the place where the link pointed to in commit fcbb11b2. --- spec/features/budget_polls/budgets_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/features/budget_polls/budgets_spec.rb b/spec/features/budget_polls/budgets_spec.rb index c70cfa94d..1ac11384d 100644 --- a/spec/features/budget_polls/budgets_spec.rb +++ b/spec/features/budget_polls/budgets_spec.rb @@ -51,7 +51,7 @@ describe "Admin Budgets" do visit admin_budgets_path within "#budget_#{budget.id}" do - expect(page).to have_link("Admin ballots", admin_poll_path(poll)) + expect(page).to have_link "Admin ballots", href: admin_poll_booth_assignments_path(poll) end end From 48cbb934c171868121ce5e68b6a2fab190427e2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Wed, 23 Oct 2019 17:25:32 +0200 Subject: [PATCH 2/5] Bump `parser` to 2.6.5.0 This version is compatible with Ruby 2.4.9. --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 6bcb44d67..2df3eb35e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -383,7 +383,7 @@ GEM parallel (1.17.0) paranoia (2.4.2) activerecord (>= 4.0, < 6.1) - parser (2.6.4.1) + parser (2.6.5.0) ast (~> 2.4.0) pg (0.21.0) pg_search (2.0.1) From b0d1d009166195a5d86272e3c80a38e52f46bffd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Wed, 23 Oct 2019 17:36:09 +0200 Subject: [PATCH 3/5] Fix modal text warning in answers documents spec It looks like we get this warning if we check the dialog message. Using `accept_confirm` the same way we do in the rest of the application solves the problem. --- .../admin/poll/questions/answers/documents/documents_spec.rb | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/spec/features/admin/poll/questions/answers/documents/documents_spec.rb b/spec/features/admin/poll/questions/answers/documents/documents_spec.rb index c8c59cd79..629b12460 100644 --- a/spec/features/admin/poll/questions/answers/documents/documents_spec.rb +++ b/spec/features/admin/poll/questions/answers/documents/documents_spec.rb @@ -34,9 +34,7 @@ describe "Documents" do visit admin_answer_documents_path(answer) expect(page).to have_content(document.title) - accept_confirm "Are you sure?" do - click_link "Delete" - end + accept_confirm { click_link "Delete" } expect(page).not_to have_content(document.title) end From 26e050b9f21ad782423c765dddf1cd4a8f0e03f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Wed, 23 Oct 2019 18:03:53 +0200 Subject: [PATCH 4/5] Remove redundant scopes These scopes were already defined by the `enum :task` method. --- app/models/poll/shift.rb | 2 -- 1 file changed, 2 deletions(-) diff --git a/app/models/poll/shift.rb b/app/models/poll/shift.rb index 828fba66e..5fc8ca9b9 100644 --- a/app/models/poll/shift.rb +++ b/app/models/poll/shift.rb @@ -10,8 +10,6 @@ class Poll enum task: { vote_collection: 0, recount_scrutiny: 1 } - scope :vote_collection, -> { where(task: "vote_collection") } - scope :recount_scrutiny, -> { where(task: "recount_scrutiny") } scope :current, -> { where(date: Date.current) } before_create :persist_data From 69e3e67c858d0b20be6081e69e54b4abc72f7657 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Wed, 23 Oct 2019 18:05:25 +0200 Subject: [PATCH 5/5] Avoid "Overwriting existing method open" warning In Ruby, the Kernel class defined the `open` method, which is available for (almost) every object. So creating a scope with the name `open` generates a warning indicating we are overwriting the existing `open` method. While this warning is pretty much harmless and we could ignore it, it generates a lot of noise in the logs. So I'm "undefining" the method before generating the scope, so we don't get the warning all the time. --- app/models/budget.rb | 1 + app/models/legislation/process.rb | 1 + 2 files changed, 2 insertions(+) diff --git a/app/models/budget.rb b/app/models/budget.rb index 8d6023fcb..614d124c0 100644 --- a/app/models/budget.rb +++ b/app/models/budget.rb @@ -55,6 +55,7 @@ class Budget < ApplicationRecord scope :reviewing_ballots, -> { where(phase: "reviewing_ballots") } scope :finished, -> { where(phase: "finished") } + class << self; undef :open; end scope :open, -> { where.not(phase: "finished") } def self.current diff --git a/app/models/legislation/process.rb b/app/models/legislation/process.rb index c07edadd6..443994506 100644 --- a/app/models/legislation/process.rb +++ b/app/models/legislation/process.rb @@ -54,6 +54,7 @@ class Legislation::Process < ApplicationRecord validates :background_color, format: { allow_blank: true, with: CSS_HEX_COLOR } validates :font_color, format: { allow_blank: true, with: CSS_HEX_COLOR } + class << self; undef :open; end scope :open, -> { where("start_date <= ? and end_date >= ?", Date.current, Date.current) } scope :active, -> { where("end_date >= ?", Date.current) } scope :past, -> { where("end_date < ?", Date.current) }