Sha256: 4068106b952eaa30e3d4520f434952fbdefac7dec2723757e75c695ba51939ad

Contents?: true

Size: 713 Bytes

Versions: 5

Compression:

Stored size: 713 Bytes

Contents

# frozen_string_literal: true

RSpec.describe SolidusSubscriptions::CreateSubscriptionJob do
  describe '#perform' do
    it 'creates new subscriptions for an order' do
      order = create(:order, :with_subscription_line_items)
      subscription_line_item = order.subscription_line_items.last

      described_class.perform_now(order)

      expect(SolidusSubscriptions::Subscription.count).to eq(order.subscription_line_items.count)
      subscription = SolidusSubscriptions::Subscription.last
      expect(subscription).to have_attributes(
        user_id: order.user_id,
        actionable_date: Time.zone.today + subscription.interval,
        line_items: [subscription_line_item]
      )
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
solidus_subscriptions-2.0.2 spec/jobs/solidus_subscriptions/create_subscription_job_spec.rb
solidus_subscriptions-2.0.1 spec/jobs/solidus_subscriptions/create_subscription_job_spec.rb
solidus_subscriptions-2.0.0 spec/jobs/solidus_subscriptions/create_subscription_job_spec.rb
solidus_subscriptions-1.1.0 spec/jobs/solidus_subscriptions/create_subscription_job_spec.rb
solidus_subscriptions-1.0.1 spec/jobs/solidus_subscriptions/create_subscription_job_spec.rb