spree/spree — pull request #2452 by huoxito (2013-01-18 06:24:04+00:00)
Title: Checks config before setting shipment 'pending' state

Spree should say a shipment is **ready** if ```allow_backorder_shipping``` is
true and the order is paid.

The following test should illustrate the issue where the admin user could not ship an order because it has some backordered items even though the config ``allow_backorder_shipping`` is true. (run it in the models/shipment_spec.rb)

```ruby
context "when order is paid" do
before { order.stub :paid? => true }

context "allow_backorder_shipping is true" do
before(:each) do
reset_spree_preferences do |config|
config.allow_backorder_shipping = true
end
end

it "should have a state of ready even if backordered" do
shipment.stub(:inventory_units => [mock_model(Spree::InventoryUnit, :backordered? => true)])
shipment.should_receive(:update_column).with("state", "ready")
shipment.update!(order)
end
end
end
```

I also tried to improve the test coverage a little bit for this config.