-
-
Notifications
You must be signed in to change notification settings - Fork 394
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Backport 'Fix error message mismatch in election' to v0.27 #11033
Backport 'Fix error message mismatch in election' to v0.27 #11033
Conversation
2dddb64
to
1452465
Compare
1452465
to
643e5e8
Compare
* Fix error message mismatch in election * Fixing hour pluralization after #10900
643e5e8
to
98dbabf
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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)
🎩 What? Why?
Backport #10946 to v0.27