Skip to content
Browse files

Refactor Order#pending_payments to use scope instead

  • Loading branch information...
1 parent 4767ab2 commit 5d46ab32133392154a6f3a8d5bfeaa0e233420b9 @joneslee85 joneslee85 committed Nov 18, 2012
Showing with 2 additions and 2 deletions.
  1. +1 −1 core/app/models/spree/order.rb
  2. +1 −1 core/spec/models/order_spec.rb
View
2 core/app/models/spree/order.rb
@@ -409,7 +409,7 @@ def payment_method
end
def pending_payments
- payments.select {|p| p.state == "checkout"}
+ payments.with_state(:checkout)
end
def process_payments!
View
2 core/spec/models/order_spec.rb
@@ -138,7 +138,7 @@ def compute(computable)
order.stub(:total).and_return(10)
payment = stub_model(Spree::Payment)
payments = [payment]
- order.stub(:payments).and_return(payments)
+ order.stub(:pending_payments).and_return(payments)
payments.first.should_receive(:process!)
order.process_payments!
end

4 comments on commit 5d46ab3

@schof
Spree Commerce member
schof commented on 5d46ab3 Nov 18, 2012

@joneslee85 Why are you changing this? There was a known issue with this approach (see 5e2ddd1)

@schof
Spree Commerce member
schof commented on 5d46ab3 Nov 18, 2012

@LBRapid Please revert this assuming @joneslee85 doesn't have a specific reason for undoing it

@joneslee85
Spree Commerce member
@radar
Spree Commerce member
Please sign in to comment.
Something went wrong with that request. Please try again.