Sha256: 449f3cffdb5fb5806ed8551a390618710affbe372bace154bef17b54cd30958c

Contents?: true

Size: 738 Bytes

Versions: 1

Compression:

Stored size: 738 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

1 entries across 1 versions & 1 rubygems

Version Path
decidim-0.1.0 decidim-admin/spec/commands/destroy_feature_spec.rb