Sha256: 1f0bfd18975a84607a1b364a45033c6bd536762e9e9fdc1f6be0cd821752cb82

Contents?: true

Size: 739 Bytes

Versions: 20

Compression:

Stored size: 739 Bytes

Contents

# frozen_string_literal: true

require "spec_helper"

module Decidim
  module Admin
    describe DestroyFeature do
      let!(:feature) { create(:feature) }
      subject { described_class.new(feature) }

      context "when everything is ok" do
        it "destroys the feature" do
          subject.call
          expect(Feature.where(id: feature.id)).not_to exist
        end

        it "fires the hooks" do
          results = {}

          feature.manifest.on(:destroy) do |feature|
            results[:feature] = feature
          end

          subject.call

          feature = results[:feature]
          expect(feature.id).to eq(feature.id)
          expect(feature).not_to be_persisted
        end
      end
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

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