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.29.1 lib/decidim/core/test/shared_examples/amendable/reject_amendment_examples.rb
decidim-core-0.28.4 lib/decidim/core/test/shared_examples/amendable/reject_amendment_examples.rb
decidim-core-0.27.9 lib/decidim/core/test/shared_examples/amendable/reject_amendment_examples.rb
decidim-core-0.29.0 lib/decidim/core/test/shared_examples/amendable/reject_amendment_examples.rb
decidim-core-0.28.3 lib/decidim/core/test/shared_examples/amendable/reject_amendment_examples.rb
decidim-core-0.27.8 lib/decidim/core/test/shared_examples/amendable/reject_amendment_examples.rb
decidim-core-0.29.0.rc4 lib/decidim/core/test/shared_examples/amendable/reject_amendment_examples.rb
decidim-core-0.29.0.rc3 lib/decidim/core/test/shared_examples/amendable/reject_amendment_examples.rb
decidim-core-0.29.0.rc2 lib/decidim/core/test/shared_examples/amendable/reject_amendment_examples.rb
decidim-core-0.29.0.rc1 lib/decidim/core/test/shared_examples/amendable/reject_amendment_examples.rb
decidim-core-0.28.2 lib/decidim/core/test/shared_examples/amendable/reject_amendment_examples.rb
decidim-core-0.27.7 lib/decidim/core/test/shared_examples/amendable/reject_amendment_examples.rb
decidim-core-0.28.1 lib/decidim/core/test/shared_examples/amendable/reject_amendment_examples.rb
decidim-core-0.27.6 lib/decidim/core/test/shared_examples/amendable/reject_amendment_examples.rb
decidim-core-0.26.10 lib/decidim/core/test/shared_examples/amendable/reject_amendment_examples.rb
decidim-core-0.26.9 lib/decidim/core/test/shared_examples/amendable/reject_amendment_examples.rb
decidim-core-0.28.0 lib/decidim/core/test/shared_examples/amendable/reject_amendment_examples.rb
decidim-core-0.27.5 lib/decidim/core/test/shared_examples/amendable/reject_amendment_examples.rb
decidim-core-0.28.0.rc5 lib/decidim/core/test/shared_examples/amendable/reject_amendment_examples.rb
decidim-core-0.28.0.rc4 lib/decidim/core/test/shared_examples/amendable/reject_amendment_examples.rb