Sha256: 96b91a7b4dceef2951a0c5559d436ee2899462fd56fdd3618ede6e33b9d55146

Contents?: true

Size: 845 Bytes

Versions: 11

Compression:

Stored size: 845 Bytes

Contents

# frozen_string_literal: true

require "spec_helper"

describe Decidim::Admin::DeactivateParticipatoryProcessStep do
  let(:process_step) { create :participatory_process_step, :active }

  subject { described_class.new(process_step) }

  context "when the step is nil" do
    let(:process_step) { nil }

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

  context "when the step is inactive" do
    let(:process_step) { create :participatory_process_step }

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

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

    it "deactivates it" do
      subject.call
      process_step.reload
      expect(process_step).not_to be_active
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
decidim-0.5.1 decidim-admin/spec/commands/deactivate_participatory_process_step_spec.rb
decidim-0.5.0 decidim-admin/spec/commands/deactivate_participatory_process_step_spec.rb
decidim-0.4.4 decidim-admin/spec/commands/deactivate_participatory_process_step_spec.rb
decidim-0.4.3 decidim-admin/spec/commands/deactivate_participatory_process_step_spec.rb
decidim-0.4.2 decidim-admin/spec/commands/deactivate_participatory_process_step_spec.rb
decidim-0.4.1 decidim-admin/spec/commands/deactivate_participatory_process_step_spec.rb
decidim-0.4.0 decidim-admin/spec/commands/deactivate_participatory_process_step_spec.rb
decidim-0.3.2 decidim-admin/spec/commands/deactivate_participatory_process_step_spec.rb
decidim-0.3.1 decidim-admin/spec/commands/deactivate_participatory_process_step_spec.rb
decidim-0.3.0 decidim-admin/spec/commands/deactivate_participatory_process_step_spec.rb
decidim-0.2.0 decidim-admin/spec/commands/deactivate_participatory_process_step_spec.rb