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.25.0.rc4 lib/decidim/core/test/shared_examples/amendable/reject_amendment_examples.rb
decidim-core-0.25.0.rc3 lib/decidim/core/test/shared_examples/amendable/reject_amendment_examples.rb
decidim-core-0.25.0.rc2 lib/decidim/core/test/shared_examples/amendable/reject_amendment_examples.rb
decidim-core-0.25.0.rc1 lib/decidim/core/test/shared_examples/amendable/reject_amendment_examples.rb
decidim-core-0.24.3 lib/decidim/core/test/shared_examples/amendable/reject_amendment_examples.rb
decidim-core-0.23.6 lib/decidim/core/test/shared_examples/amendable/reject_amendment_examples.rb
decidim-core-0.24.2 lib/decidim/core/test/shared_examples/amendable/reject_amendment_examples.rb
decidim-core-0.23.5 lib/decidim/core/test/shared_examples/amendable/reject_amendment_examples.rb
decidim-core-0.24.1 lib/decidim/core/test/shared_examples/amendable/reject_amendment_examples.rb
decidim-core-0.24.0 lib/decidim/core/test/shared_examples/amendable/reject_amendment_examples.rb
decidim-core-0.24.0.rc2 lib/decidim/core/test/shared_examples/amendable/reject_amendment_examples.rb
decidim-core-0.23.4 lib/decidim/core/test/shared_examples/amendable/reject_amendment_examples.rb
decidim-core-0.24.0.rc1 lib/decidim/core/test/shared_examples/amendable/reject_amendment_examples.rb
decidim-core-0.23.3 lib/decidim/core/test/shared_examples/amendable/reject_amendment_examples.rb
decidim-core-0.23.2 lib/decidim/core/test/shared_examples/amendable/reject_amendment_examples.rb
decidim-core-0.23.1 lib/decidim/core/test/shared_examples/amendable/reject_amendment_examples.rb
decidim-core-0.23.1.rc1 lib/decidim/core/test/shared_examples/amendable/reject_amendment_examples.rb
decidim-core-0.23.0 lib/decidim/core/test/shared_examples/amendable/reject_amendment_examples.rb
decidim-core-0.22.0 lib/decidim/core/test/shared_examples/amendable/reject_amendment_examples.rb
decidim-core-0.21.0 lib/decidim/core/test/shared_examples/amendable/reject_amendment_examples.rb