Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backport 'Allow to publish an Election even if it hasn't valid Questions' to v0.26 #11032

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -24,10 +24,8 @@ def permissions
case permission_action.action
when :create, :read
allow!
when :delete, :update, :unpublish
when :delete, :update, :unpublish, :publish
allow_if_not_blocked
when :publish
allow_if_valid_and_not_blocked
end
when :trustees
case permission_action.action
Expand Down Expand Up @@ -80,10 +78,6 @@ def allow_if_not_blocked
toggle_allow(election && !election.blocked?)
end

def allow_if_valid_and_not_blocked
toggle_allow(election && !election.blocked? && election.valid_questions?)
end

def allow_if_not_related_to_any_election
toggle_allow(trustee_participatory_space.trustee.elections.empty?)
end
Expand Down
Expand Up @@ -32,15 +32,6 @@
end
end

shared_examples "not allowed when election has invalid questions" do
context "when election has invalid questions" do
let(:election) { create :election, component: elections_component }
let(:question) { create :question, :candidates, max_selections: 11, election: election }

it { is_expected.to eq false }
end
end

shared_examples "not allowed when trustee has elections" do
context "when trustee has elections" do
let(:trustee) { create :trustee, :with_elections }
Expand Down Expand Up @@ -102,7 +93,6 @@
it { is_expected.to eq true }

it_behaves_like "not allowed when election was created on the bulletin board"
it_behaves_like "not allowed when election has invalid questions"
end

describe "election delete" do
Expand Down