spree/spree — pull request #2419 by mtylty (2013-01-10 14:40:43+00:00)
Title: fixes variant factory

If you set `:track_inventory_levels` to `false`, the variant factory is broken.

Since both the variant and product factory has the on_hand attribute set, calling `FactoryGirl.create(:variant)` raises `Cannot set on_hand value when Spree::Config[:track_inventory_levels] is false`.

There's a test in `core/spec/models/variant_spec.rb` but it's useless to detect the error because it swallows the exception making the test pass.

I created two new factories (`:base_variant` and `:base_product`) that don't have `on_hand` set. Probably it's better to remove on_hand altogether (which is frequently passed anyway to factory creation calls) but I couldn't make up my mind so went for the simpler route.