spree/spree-product-assembly — pull request #27 by robertoles (2013-04-26 07:56:43+00:00)
Title: Fixing the test suite in 1-3-stable

Hi, yesterday I was trying to fix a bug and ran in to some issues trying to run the specs. The first issue was the inclusion of spree in the gemfile, which was fixed to version 1, however the gemspec being fixed to version 1.3.2. I pulled a commit from master to fix this.

This enabled me to actually run the specs, however, every spec was now failing. I pulled another commit from master from a few months back which was aimed at getting tests working again, however this had no impact.

All the tests were failing due to a circular reference being created by the use of alias_method and alias_method_chain in product_dectorator.rb. After some investigation I found that this was due to the product decorator being loaded more than once. Because of this the alias_method calls were re-run, aliasing the referenced method name to the overridden method, creating the circular reference. I have fixed this by including a check to see if the aliased name for each method already exists, and if so, not calling alias again.

Im still unsure why the file is being loaded multiple times, maybe its the version of ruby im running? (1.9.3-p392, osx 10.8.3, build using ruby-build)

After finally getting the specs up and running I noticed a few were failing, I believe this is probably due to changes in spree master, it looks like on_hand is being set in the product factory in spree, and tests in product-assembly were requiring the factory built product to have an on_hand setting of 0, so I changed the factory call to build instances of :base_product, where on_hand isnt being set.

Sorry for the long winded description, I hope its ok sending this all as one commit.