spree/spree — pull request #5505 by BenMorganIO (2014-10-19 05:01:35+00:00)
Title: Default price to concern

This PR moves the default pricing functionality to a concern. Sometimes a developer will want to make a new belongs to association for the price model. When adding default pricing, I found myself copy and pasting the code that was later put into this concern. This PR should help DRY up some of the variant model as well as allow developers to do more with customizing spree.

I noticed that `Spree::Price#check_price?` used an if statement for nil, refactored to memoization. Also, considering I moved the default price functionality to a concern, I remove the raise when not a variant as well.

For testing support, I removed `generate(:sku)` in favor of `Faker::Product.model`. The reasoning to this was that while making the specs for the default pricing concern, I kept receiving errors alerting me that the sku was already taken. This should help this.

In the variant spec, I removed one of the deprecation warnings for RSpec 3.0. Also, I have a line that states that it behaves like a default price. The default price shared example is sitting in the support/concerns folder and being required through the spec helper.