diff --git a/decidim-comments/spec/forms/comment_form_spec.rb b/decidim-comments/spec/forms/comment_form_spec.rb index 98440720a6abd..b1636c3486c06 100644 --- a/decidim-comments/spec/forms/comment_form_spec.rb +++ b/decidim-comments/spec/forms/comment_form_spec.rb @@ -10,11 +10,13 @@ module Comments attributes ).with_context( current_organization: organization, - current_component: component + current_component: component, + current_user: user ) end let(:organization) { create(:organization) } + let(:user) { create(:user, :confirmed, organization:) } let(:admin_user) { create(:user, :admin, :confirmed, organization:) } let(:user_manager) { create(:user, :user_manager, :confirmed, organization:) } let!(:component) { create(:component, organization:) } @@ -23,7 +25,7 @@ module Comments let(:user_group) { create(:user_group, :verified) } let(:user_group_id) { user_group.id } - let(:commentable) { create(:dummy_resource, accepts_new_comments?: false) } + let(:commentable) { create(:dummy_resource) } let(:attributes) do { @@ -114,10 +116,6 @@ module Comments end describe "#commentable_can_have_comments" do - before do - allow(subject).to receive(:current_user).and_return(current_user) - end - context "when user is admin" do let(:current_user) { admin_user } diff --git a/decidim-core/lib/decidim/core/test/shared_examples/comments_examples.rb b/decidim-core/lib/decidim/core/test/shared_examples/comments_examples.rb index e765da0bd8c17..4eb311a96caca 100644 --- a/decidim-core/lib/decidim/core/test/shared_examples/comments_examples.rb +++ b/decidim-core/lib/decidim/core/test/shared_examples/comments_examples.rb @@ -1068,6 +1068,19 @@ it_behaves_like "can answer comments" end + + context "when the user has a role of user manager" do + let!(:user) { create(:user, :user_manager, :confirmed, organization:) } + + it_behaves_like "can answer comments" + end + + context "when the user has an evaluator role" do + let!(:participatory_process) { create(:participatory_process, :with_steps, organization:) } + let!(:valuator_role) { create(:participatory_process_user_role, role: :valuator, user:, participatory_process:) } + + it_behaves_like "can answer comments" + end end end end