New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allowing a shipment to be ready for resumed orders #2317
Conversation
I like the idea of a |
It might be a contrived example but let's consider one order in the But if you're ok with that (or if you have a better or less ambiguous name) BTW: this state machine implementation is freaking awesome. Congrats on
|
@@ -45,7 +45,11 @@ | |||
end | |||
|
|||
context "when order is incomplete" do | |||
before { order.stub :complete? => false } | |||
before do | |||
order.stub :complete? => false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit-pick: indentation here is one character too far.
I think order.can_ship? is a good idea, and not confusing- you're asking the order it is willing to allow shipments. Each individual shipment is ultimately responsible for deciding it's state, after the order gives it's permission. |
…r is willing to allow shipments
@@ -178,10 +197,10 @@ def compute(computable) | |||
end | |||
end | |||
|
|||
context "#complete?" do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I allowed myself to change that as well, because it seems to me that the completed?
behaviour and not the complete?
state were tested
I think this is ok. I don't mind that caveat.
Thanks :) I'm really proud that we were able to get something that works that well! |
I have implemented can_ship? earlier today and updated the PR.
|
@radar - did you mean to cherry-pick this on your radar/spree? and not spree/spree? |
Yup. That's where I'm running the builds from now rather than pushing to GH. On 15/12/2012, at 4:27, Brian Quinn notifications@github.com wrote:
|
Fixes #2317 Conflicts: core/app/models/spree/shipment.rb core/spec/models/order_spec.rb core/spec/models/shipment_spec.rb
@radar: To respect the
tell don't ask
principle, I would like to replacereturn 'pending' unless order.complete? || order.resumed?
with something like
return 'pending' unless order.can_ship?
but that might lead to some confusion elsewhere. Let me know what you think and I can adjust it accordingly