Sha256: 13bb0d90e3ca7aa91b49c78d0d90cec1e49637aa3aad9ad99b97310181ff2270

Contents?: true

Size: 989 Bytes

Versions: 7

Compression:

Stored size: 989 Bytes

Contents

# frozen_string_literal: true

require 'spec_helper'

RSpec.describe SolidusSubscriptions::Promotion::Rules::SubscriptionInstallmentOrder do
  let(:rule) { described_class.new }

  describe '#applicable' do
    subject { rule.applicable? promotable }

    context 'when the promotable is a Spree::Order' do
      let(:promotable) { build_stubbed :order }

      it { is_expected.to be_truthy }
    end

    context 'when the promotable is not a Spree::Order' do
      let(:promotable) { build_stubbed :line_item }

      it { is_expected.to be_falsy }
    end
  end

  describe '#eligible?' do
    subject { rule.eligible? order }

    context 'when the order fulfills a subscription installment' do
      let(:order) { create(:order, subscription_order: true) }

      it { is_expected.to be_truthy }
    end

    context 'when the order contains does not fulfill a subscription installment' do
      let(:order) { create(:order) }

      it { is_expected.to be_falsy }
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
solidus_subscriptions-2.0.2 spec/lib/solidus_subscriptions/promotion/rules/subscription_installment_order_spec.rb
solidus_subscriptions-2.0.1 spec/lib/solidus_subscriptions/promotion/rules/subscription_installment_order_spec.rb
solidus_subscriptions-2.0.0 spec/lib/solidus_subscriptions/promotion/rules/subscription_installment_order_spec.rb
solidus_subscriptions-1.1.0 spec/lib/solidus_subscriptions/promotion/rules/subscription_installment_order_spec.rb
solidus_subscriptions-1.0.1 spec/lib/solidus_subscriptions/promotion/rules/subscription_installment_order_spec.rb
solidus_subscriptions-1.0.0 spec/lib/solidus_subscriptions/promotion/rules/subscription_installment_order_spec.rb
solidus_subscriptions-1.0.0.rc1 spec/lib/solidus_subscriptions/promotion/rules/subscription_installment_order_spec.rb