Sha256: da7d67a2b2ff001617d181fcd33b50a209df133a489c4b1f059c6055a8ccfb51

Contents?: true

Size: 1.1 KB

Versions: 71

Compression:

Stored size: 1.1 KB

Contents

# frozen_string_literal: true

shared_examples "reject amendment" do
  describe "when the form is valid" do
    it "broadcasts ok" do
      expect { command.call }.to broadcast(:ok)
    end

    it "changes the emendation state to rejected" do
      expect { command.call }.to change(emendation, :state)
        .from("evaluating").to("rejected")
    end

    it "traces the action", versioning: true do
      expect(Decidim.traceability)
        .to receive(:update!)
        .with(
          amendment,
          amendable.creator_author,
          { state: "rejected" },
          visibility: "public-only"
        ).and_call_original

      expect { command.call }.to change(Decidim::ActionLog, :count).by(1)
    end

    it "notifies the change" do
      expect(Decidim::EventsManager)
        .to receive(:publish)
        .with(
          event: "decidim.events.amendments.amendment_rejected",
          event_class: Decidim::Amendable::AmendmentRejectedEvent,
          resource: emendation,
          affected_users: kind_of(Array),
          followers: kind_of(Array)
        )

      command.call
    end
  end
end

Version data entries

71 entries across 71 versions & 1 rubygems

Version Path
decidim-core-0.26.8 lib/decidim/core/test/shared_examples/amendable/reject_amendment_examples.rb
decidim-core-0.27.4 lib/decidim/core/test/shared_examples/amendable/reject_amendment_examples.rb
decidim-core-0.27.3 lib/decidim/core/test/shared_examples/amendable/reject_amendment_examples.rb
decidim-core-0.26.7 lib/decidim/core/test/shared_examples/amendable/reject_amendment_examples.rb
decidim-core-0.26.5 lib/decidim/core/test/shared_examples/amendable/reject_amendment_examples.rb
decidim-core-0.27.2 lib/decidim/core/test/shared_examples/amendable/reject_amendment_examples.rb
decidim-core-0.27.1 lib/decidim/core/test/shared_examples/amendable/reject_amendment_examples.rb
decidim-core-0.26.4 lib/decidim/core/test/shared_examples/amendable/reject_amendment_examples.rb
decidim-core-0.27.0 lib/decidim/core/test/shared_examples/amendable/reject_amendment_examples.rb
decidim-core-0.26.3 lib/decidim/core/test/shared_examples/amendable/reject_amendment_examples.rb
decidim-core-0.27.0.rc2 lib/decidim/core/test/shared_examples/amendable/reject_amendment_examples.rb
decidim-core-0.27.0.rc1 lib/decidim/core/test/shared_examples/amendable/reject_amendment_examples.rb
decidim-core-0.26.2 lib/decidim/core/test/shared_examples/amendable/reject_amendment_examples.rb
decidim-core-0.26.1 lib/decidim/core/test/shared_examples/amendable/reject_amendment_examples.rb
decidim-core-0.26.0 lib/decidim/core/test/shared_examples/amendable/reject_amendment_examples.rb
decidim-core-0.26.0.rc2 lib/decidim/core/test/shared_examples/amendable/reject_amendment_examples.rb
decidim-core-0.26.0.rc1 lib/decidim/core/test/shared_examples/amendable/reject_amendment_examples.rb
decidim-core-0.25.2 lib/decidim/core/test/shared_examples/amendable/reject_amendment_examples.rb
decidim-core-0.25.1 lib/decidim/core/test/shared_examples/amendable/reject_amendment_examples.rb
decidim-core-0.25.0 lib/decidim/core/test/shared_examples/amendable/reject_amendment_examples.rb