Sha256: 7f0cbe1d5951f676babc46ac3240d4a29396c65186b7200f5819bdb060309a4f

Contents?: true

Size: 842 Bytes

Versions: 1

Compression:

Stored size: 842 Bytes

Contents

# frozen_string_literal: true
require "spec_helper"

describe Decidim::Admin::UnpublishParticipatoryProcess do
  let(:my_process) { create :participatory_process }

  subject { described_class.new(my_process) }

  context "when the process is nil" do
    let(:my_process) { nil }

    it "is not valid" do
      expect { subject.call }.to broadcast(:invalid)
    end
  end

  context "when the process is not published" do
    let(:my_process) { create :participatory_process, :unpublished }

    it "is not valid" do
      expect { subject.call }.to broadcast(:invalid)
    end
  end

  context "when the process is published" do
    it "is valid" do
      expect { subject.call }.to broadcast(:ok)
    end

    it "unpublishes it" do
      subject.call
      my_process.reload
      expect(my_process).not_to be_published
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
decidim-0.1.0 decidim-admin/spec/commands/unpublish_participatory_process_spec.rb