spree/spree — pull request #5767 by adaddeo (2014-12-12 21:16:59+00:00)
Title: allow for arbitrary promo adjustments to compete

This is in favor of #5729, which includes specs and has been updated to refactored AdjustmentUpdater.

This allows for arbitrary adjustment types to compete for the best_promo_adjustment spot by registering with the Spree::Adjustment.competing_promos_source_types attribute.

I changed the `best_promotion_adjustment` method name to `best_promo_adjustment` to make it more clear that we are looking for the best promo, which includes but isn't limited to the "Promotion" adjustments (in the Spree::Promotion sense).

I almost think changing everywhere the term 'promo' is used to 'discount' would make some subtleties clearer and the language more general. For instance, the promo_total isn't necessarily the same as the best Promotion, it is just the best discount, no matter where it originated; changing it discount_total would make this more obvious. I feel like it would make adjustment_updater also feel more general case, since every store has a concept of taxes and discounts, whereas a "promotion" is a specific type of discount.

I would love feedback on the approach here, as well as the specs.