Sha256: 898f84205f02bdd1ae69849e6345e02a4a2133b15c6aa63f678f4f29b0f2cd13

Contents?: true

Size: 786 Bytes

Versions: 20

Compression:

Stored size: 786 Bytes

Contents

# frozen_string_literal: true

require "spec_helper"

describe "Proposals feature" do
  let!(:feature) { create(:proposal_feature) }

  describe "on destroy" do
    context "when there are no proposals for the feature" do
      it "destroys the feature" do
        expect do
          Decidim::Admin::DestroyFeature.call(feature)
        end.to change { Decidim::Feature.count }.by(-1)

        expect(feature).to be_destroyed
      end
    end

    context "when there are proposals for the feature" do
      before do
        create(:proposal, feature: feature)
      end

      it "raises an error" do
        expect do
          Decidim::Admin::DestroyFeature.call(feature)
        end.to broadcast(:invalid)

        expect(feature).not_to be_destroyed
      end
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
decidim-0.6.8 decidim-proposals/spec/lib/decidim/proposals/feature_spec.rb
decidim-0.6.7 decidim-proposals/spec/lib/decidim/proposals/feature_spec.rb
decidim-0.6.6 decidim-proposals/spec/lib/decidim/proposals/feature_spec.rb
decidim-0.6.5 decidim-proposals/spec/lib/decidim/proposals/feature_spec.rb
decidim-0.6.4 decidim-proposals/spec/lib/decidim/proposals/feature_spec.rb
decidim-0.6.3 decidim-proposals/spec/lib/decidim/proposals/feature_spec.rb
decidim-0.6.2 decidim-proposals/spec/lib/decidim/proposals/feature_spec.rb
decidim-0.6.1 decidim-proposals/spec/lib/decidim/proposals/feature_spec.rb
decidim-0.6.0 decidim-proposals/spec/lib/decidim/proposals/feature_spec.rb
decidim-0.5.1 decidim-proposals/spec/lib/decidim/proposals/feature_spec.rb
decidim-0.5.0 decidim-proposals/spec/lib/decidim/proposals/feature_spec.rb
decidim-0.4.4 decidim-proposals/spec/lib/decidim/proposals/feature_spec.rb
decidim-0.4.3 decidim-proposals/spec/lib/decidim/proposals/feature_spec.rb
decidim-0.4.2 decidim-proposals/spec/lib/decidim/proposals/feature_spec.rb
decidim-0.4.1 decidim-proposals/spec/lib/decidim/proposals/feature_spec.rb
decidim-0.4.0 decidim-proposals/spec/lib/decidim/proposals/feature_spec.rb
decidim-0.3.2 decidim-proposals/spec/lib/decidim/proposals/feature_spec.rb
decidim-0.3.1 decidim-proposals/spec/lib/decidim/proposals/feature_spec.rb
decidim-0.3.0 decidim-proposals/spec/lib/decidim/proposals/feature_spec.rb
decidim-0.2.0 decidim-proposals/spec/lib/decidim/proposals/feature_spec.rb