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

Refactor calculators to be more opinionated what to compute #4041

Closed
wants to merge 15 commits into
base: master
from
Commits
Jump to file or symbol
Failed to load files and symbols.
+9 −4
Diff settings

Always

Just for now

Viewing a subset of changes. View all

improve the specs to better document the shipping_calculator

  • Loading branch information...
peterberkenbosch committed Dec 6, 2013
commit a0542b47514247731336f674f00c22349d378a04
@@ -23,17 +23,22 @@ module Spree
it 'computes with a shipment' do
shipment = mock_model(Spree::Shipment)
shipment.should_receive(:to_package).and_return(package)
subject.should_receive(:compute_package).with(package)
subject.compute(shipment.to_package)
subject.should_receive(:compute_shipment).with(shipment)
subject.compute(shipment)
end
it 'computes with a package' do
subject.should_receive(:compute_package).with(package)
subject.compute(package)
end
it 'compute must be overridden' do
it 'compute_shipment must be overridden' do
expect {
subject.compute_shipment(shipment)
}.to raise_error
end
it 'compute_package must be overridden' do
expect {
subject.compute_package(package)
}.to raise_error
ProTip! Use n and p to navigate between commits in a pull request.