Sha256: f6d1b73c34e3c3fe449e84e888996420a6367b0ce55919257a40a458f9f27ae5
Contents?: true
Size: 1.2 KB
Versions: 1
Compression:
Stored size: 1.2 KB
Contents
# frozen_string_literal: true require "spec_helper" describe Decidim::Admin::ReorderParticipatoryProcessSteps do let(:process) { create :participatory_process } let!(:process_step1) do create( :participatory_process_step, participatory_process: process, position: 1 ) end let!(:process_step2) do create( :participatory_process_step, participatory_process: process, position: 2 ) end let(:collection) { process.steps } let(:order) { [process_step2.id, process_step1.id] } subject { described_class.new(collection, order) } context "when the order is nil" do let(:order) { nil } it "is not valid" do expect { subject.call }.to broadcast(:invalid) end end context "when the order is empty" do let(:order) { [] } it "is not valid" do expect { subject.call }.to broadcast(:invalid) end end context "when the order is valid" do it "is valid" do expect { subject.call }.to broadcast(:ok) end it "reorders the steps" do subject.call process_step1.reload process_step2.reload expect(process_step1.position).to eq 1 expect(process_step2.position).to eq 0 end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
decidim-0.1.0 | decidim-admin/spec/commands/reorder_participatory_process_steps_spec.rb |