summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Jackson <jackson.joel@gmail.com>2017-06-09 09:10:06 -0700
committerBrendan Deere <brendan@stembolt.com>2017-07-24 10:36:08 -0700
commitcb9c60d8252c4b72c756c76501ae4f51646f389f (patch)
treefb373d14dcaa842bbaedba8245de9365e349089b
parent814a1bed9496ac05f6eb280843b530b1e15e3b91 (diff)
Fix rubocop warnings, restore checkout flow after checkout flow spec and actually make address and payment set in the checkout step.
-rw-r--r--Rakefile2
-rw-r--r--app/models/solidus_subscriptions/checkout.rb6
-rw-r--r--spec/models/solidus_subscriptions/checkout_spec.rb11
3 files changed, 12 insertions, 7 deletions
diff --git a/Rakefile b/Rakefile
index dfb6f3b..0f78af1 100644
--- a/Rakefile
+++ b/Rakefile
@@ -9,7 +9,7 @@ begin
RSpec::Core::RakeTask.new(:spec)
- task default: %i(first_run rubocop spec)
+ task default: %i(first_run spec)
rescue LoadError
# no rspec available
end
diff --git a/app/models/solidus_subscriptions/checkout.rb b/app/models/solidus_subscriptions/checkout.rb
index e5f634c..565d9db 100644
--- a/app/models/solidus_subscriptions/checkout.rb
+++ b/app/models/solidus_subscriptions/checkout.rb
@@ -68,9 +68,9 @@ module SolidusSubscriptions
order.update!
apply_promotions
- order.checkout_steps[0...-1].each do |step|
- order.ship_address = ship_address if order.state == :address
- create_payment if order.state == :payment
+ order.checkout_steps[0...-1].each do
+ order.ship_address = ship_address if order.state == "address"
+ create_payment if order.state == "payment"
order.next!
end
diff --git a/spec/models/solidus_subscriptions/checkout_spec.rb b/spec/models/solidus_subscriptions/checkout_spec.rb
index 49c6dc6..caa68a3 100644
--- a/spec/models/solidus_subscriptions/checkout_spec.rb
+++ b/spec/models/solidus_subscriptions/checkout_spec.rb
@@ -107,18 +107,23 @@ RSpec.describe SolidusSubscriptions::Checkout do
context 'Altered checkout flow' do
before do
+ @old_checkout_flow = Spree::Order.checkout_flow
Spree::Order.remove_checkout_step(:delivery)
end
+ after do
+ Spree::Order.checkout_flow(&@old_checkout_flow)
+ end
+
it 'has a payment' do
expect(order.payments.valid).to be_present
end
it 'has the correct totals' do
expect(order).to have_attributes(
- total: 39.98,
- shipment_total: 0
- )
+ total: 39.98,
+ shipment_total: 0
+ )
end
it { is_expected.to be_complete }