Skip to content

Commit

Permalink
tests: add tests for event and update test for command
Browse files Browse the repository at this point in the history
  • Loading branch information
Stef-Rousset committed Feb 14, 2025
1 parent d6eb4d5 commit 0096e95
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,17 @@ module Proposals
}
)

expect(Decidim::EventsManager)
.to receive(:publish)
.with(
event: "decidim.events.proposals.author_confirmation_proposal_event",
event_class: Decidim::Proposals::AuthorConfirmationProposalEvent,
resource: kind_of(Decidim::Proposals::Proposal),
affected_users: [proposal_draft.creator_identity],
extra: { force_email: true },
force_send: true
)

subject.call
end
end
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# frozen_string_literal: true

require "spec_helper"

module Decidim
module Proposals
describe AuthorConfirmationProposalEvent do
let(:resource) { create(:proposal) }
let(:participatory_process) { create(:participatory_process, organization:) }
let(:proposal_component) { create(:proposal_component, participatory_space: participatory_process) }
let(:event_name) { "decidim.events.proposals.author_confirmation_proposal_event" }

include_context "when a simple event"

it_behaves_like "a simple event"

describe "resource_title" do
it "returns the proposal title" do
expect(subject.resource_title).to eq(decidim_sanitize_translated(resource.title))
end
end
end
end
end

0 comments on commit 0096e95

Please sign in to comment.