Sha256: cd6dc302a4baa84b87076f4aab7f63eefadb129d84882cc3c156732b328f89f7

Contents?: true

Size: 825 Bytes

Versions: 5

Compression:

Stored size: 825 Bytes

Contents

# frozen_string_literal: true

require 'spec_helper'

RSpec.describe SolidusSubscriptions::Spree::Variant::AutoDeleteFromSubscriptions, type: :model do
  subject { create(:variant, subscribable: true) }

  describe '.discard' do
    it 'deletes itself from subscriptions' do
      subscription = create(:subscription)
      create(:subscription_line_item, subscription: subscription, subscribable: subject)

      expect { subject.discard }.to change(SolidusSubscriptions::LineItem, :count).by(-1)
    end
  end

  describe '.destroy' do
    it 'deletes itself from subscriptions' do
      subscription = create(:subscription)
      create(:subscription_line_item, subscription: subscription, subscribable: subject)

      expect { subject.destroy }.to change(SolidusSubscriptions::LineItem, :count).by(-1)
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
solidus_subscriptions-2.0.2 spec/decorators/models/solidus_subscriptions/spree/variant/auto_delete_from_subscriptions_spec.rb
solidus_subscriptions-2.0.1 spec/decorators/models/solidus_subscriptions/spree/variant/auto_delete_from_subscriptions_spec.rb
solidus_subscriptions-2.0.0 spec/decorators/models/solidus_subscriptions/spree/variant/auto_delete_from_subscriptions_spec.rb
solidus_subscriptions-1.1.0 spec/decorators/models/solidus_subscriptions/spree/variant/auto_delete_from_subscriptions_spec.rb
solidus_subscriptions-1.0.1 spec/decorators/models/solidus_subscriptions/spree/variant/auto_delete_from_subscriptions_spec.rb