Backport 'Fix error message mismatch in election' to v0.26#11034
Merged
andreslucena merged 3 commits intorelease/0.26-stablefrom Jun 15, 2023
Merged
Conversation
* Fix error message mismatch in election * Fixing hour pluralization after #10900
8d79401 to
bc73cf2
Compare
andreslucena
requested changes
Jun 15, 2023
Member
andreslucena
left a comment
There was a problem hiding this comment.
I see that we're introducing the change in configuration in #10900, as we're changing the specs for this backport.
I'd prefer to leave that change out of this PR as it's a change of the configuration. We would need to change the spec, leaving this particular backport untested. I propose that we introduce a spec for this change, something like this is what I have in mind:
diff --git a/decidim-elections/spec/forms/decidim/elections/admin/setup_form_spec.rb b/decidim-elections/spec/forms/decidim/elections/admin/setup_form_spec.rb
index ece436517e..38fcdbdbe8 100644
--- a/decidim-elections/spec/forms/decidim/elections/admin/setup_form_spec.rb
+++ b/decidim-elections/spec/forms/decidim/elections/admin/setup_form_spec.rb
@@ -76,6 +76,28 @@ describe Decidim::Elections::Admin::SetupForm do
end
end
+ context "when the hours before the start do not comply" do
+ before do
+ allow(Decidim::Elections).to receive(:setup_minimum_hours_before_start).and_return(hours_before)
+ end
+
+ context "and there is one hour" do
+ let(:hours_before) { 1 }
+
+ it "shows the message" do
+ expect(subject.messages).to match(hash_including({ time_before: "The setup is being done <strong>at least 1 hour</strong> before the election starts." }))
+ end
+ end
+
+ context "and there are three hours" do
+ let(:hours_before) { 3 }
+
+ it "shows the message" do
+ expect(subject.messages).to match(hash_including({ time_before: "The setup is being done <strong>at least 3 hours</strong> before the election starts." }))
+ end
+ end
+ end
+
context "when there are no trustees for the election" do
let(:trustees) { [] }(Feel free to change it to your taste)
andreslucena
approved these changes
Jun 15, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🎩 What? Why?
Backport #10946 to v0.26