Sha256: 20dc6504f3e89f8956c78c0be273769d8ff97c413cedd9ee83f2ce682b24c1b7

Contents?: true

Size: 1.12 KB

Versions: 7

Compression:

Stored size: 1.12 KB

Contents

# frozen_string_literal: true

RSpec.describe SolidusSubscriptions::Processor do
  it 'schedules the processing of actionable subscriptions' do
    actionable_subscription = create(:subscription, :actionable)

    described_class.run

    expect(SolidusSubscriptions::ProcessSubscriptionJob).to have_been_enqueued
      .with(actionable_subscription)
  end

  it 'schedules the processing of non actionable subscriptions with actionable installments' do
    subscription_with_actionable_installment = create(
      :subscription,
      actionable_date: Time.zone.today + 7.days,
      installments: [create(:installment, :actionable)]
    )

    described_class.run

    expect(SolidusSubscriptions::ProcessSubscriptionJob).to have_been_enqueued
      .with(subscription_with_actionable_installment)
  end

  it 'does not schedule the processing of non actionable subscriptions' do
    non_actionable_subscription = create(:subscription, actionable_date: Time.zone.today + 14.days)

    described_class.run

    expect(SolidusSubscriptions::ProcessSubscriptionJob).not_to have_been_enqueued
      .with(non_actionable_subscription)
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

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