Sha256: cb5a336ed0490fd2b2fc0e6b1c26767434b55c16606da3ac87d506e7cfadff5f

Contents?: true

Size: 818 Bytes

Versions: 9

Compression:

Stored size: 818 Bytes

Contents

# frozen_string_literal: true

require "spec_helper"

describe Decidim::Assemblies::Admin::PublishAssembly do
  let(:my_assembly) { create :assembly, :unpublished }

  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 published" do
    let(:my_assembly) { create :assembly }

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

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

    it "publishes it" do
      subject.call
      my_assembly.reload
      expect(my_assembly).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/publish_assembly_spec.rb
decidim-0.6.7 decidim-assemblies/spec/commands/publish_assembly_spec.rb
decidim-0.6.6 decidim-assemblies/spec/commands/publish_assembly_spec.rb
decidim-0.6.5 decidim-assemblies/spec/commands/publish_assembly_spec.rb
decidim-0.6.4 decidim-assemblies/spec/commands/publish_assembly_spec.rb
decidim-0.6.3 decidim-assemblies/spec/commands/publish_assembly_spec.rb
decidim-0.6.2 decidim-assemblies/spec/commands/publish_assembly_spec.rb
decidim-0.6.1 decidim-assemblies/spec/commands/publish_assembly_spec.rb
decidim-0.6.0 decidim-assemblies/spec/commands/publish_assembly_spec.rb