Sha256: 46f0363079ce5bebace623a2abc144abd2d96892e6abefe264fdaa403ec19319

Contents?: true

Size: 826 Bytes

Versions: 9

Compression:

Stored size: 826 Bytes

Contents

# frozen_string_literal: true

require "spec_helper"

describe Decidim::Assemblies::Admin::UnpublishAssembly do
  let(:my_assembly) { create :assembly }

  subject { described_class.new(my_assembly) }

  context "when the assembly is nil" do
    let(:my_assembly) { nil }

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

  context "when the assembly is not published" do
    let(:my_assembly) { create :assembly, :unpublished }

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

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

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

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
decidim-0.6.8 decidim-assemblies/spec/commands/unpublish_assembly_spec.rb
decidim-0.6.7 decidim-assemblies/spec/commands/unpublish_assembly_spec.rb
decidim-0.6.6 decidim-assemblies/spec/commands/unpublish_assembly_spec.rb
decidim-0.6.5 decidim-assemblies/spec/commands/unpublish_assembly_spec.rb
decidim-0.6.4 decidim-assemblies/spec/commands/unpublish_assembly_spec.rb
decidim-0.6.3 decidim-assemblies/spec/commands/unpublish_assembly_spec.rb
decidim-0.6.2 decidim-assemblies/spec/commands/unpublish_assembly_spec.rb
decidim-0.6.1 decidim-assemblies/spec/commands/unpublish_assembly_spec.rb
decidim-0.6.0 decidim-assemblies/spec/commands/unpublish_assembly_spec.rb