Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
aldesantis committed Jan 8, 2021
1 parent 438390b commit 3e46071
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 3 deletions.
3 changes: 3 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@ RSpec/DescribeClass:
Exclude:
- spec/requests/**/*
- spec/features/**/*

Rails/SkipsModelValidations:
Enabled: false
2 changes: 1 addition & 1 deletion app/models/solidus_subscriptions/installment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class Installment < ApplicationRecord
end)

scope :with_active_subscription, (lambda do
joins(:subscription).where.not(Subscription.table_name => {state: "canceled"})
joins(:subscription).where.not(Subscription.table_name => { state: "canceled" })
end)

scope :actionable, (lambda do
Expand Down
2 changes: 1 addition & 1 deletion spec/lib/solidus_subscriptions/processor_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@

described_class.run

expect((subscription.reload.actionable_date).to_date).to eq((old_actionable_date + 1.week).to_date)
expect(subscription.reload.actionable_date.to_date).to eq((old_actionable_date + 1.week).to_date)
end
end

Expand Down
11 changes: 10 additions & 1 deletion spec/services/solidus_subscriptions/checkout_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
expect(order).to be_paid
end

# rubocop:disable RSpec/MultipleExpectations
it 'copies basic information from the subscription' do
stub_spree_preferences(auto_capture: true)
installment = create(:installment, :actionable)
Expand All @@ -24,6 +25,7 @@
expect(order.user).to eq(subscription.user)
expect(order.email).to eq(subscription.user.email)
end
# rubocop:enable RSpec/MultipleExpectations

it 'marks the order as a subscription order' do
stub_spree_preferences(auto_capture: true)
Expand Down Expand Up @@ -92,7 +94,14 @@
stub_spree_preferences(auto_capture: true)
installment = create(:installment, :actionable)
failure_dispatcher = stub_dispatcher(SolidusSubscriptions::Dispatcher::FailureDispatcher, installment)
allow_any_instance_of(Spree::Order).to receive(:next!).and_raise(StateMachines::InvalidTransition.new(Spree::Order.new, Spree::Order.state_machines[:state], :next))
# rubocop:disable RSpec/AnyInstance
allow_any_instance_of(Spree::Order).to receive(:next!)
.and_raise(StateMachines::InvalidTransition.new(
Spree::Order.new,
Spree::Order.state_machines[:state],
:next,
))
# rubocop:enable RSpec/AnyInstance

described_class.new(installment).process

Expand Down

0 comments on commit 3e46071

Please sign in to comment.