Permalink
Browse files

Regression test for inadvertent ShippingMethod per-item calculator br…

…eakage

Replicates #1596
  • Loading branch information...
1 parent df94079 commit aae01aaa46b48987250510423cca964225a5b676 @radar radar committed May 25, 2012
Showing with 39 additions and 0 deletions.
  1. +39 −0 core/spec/requests/checkout_spec.rb
@@ -27,6 +27,45 @@
within(:css, "span.out-of-stock") { page.should have_content("Out of Stock") }
end
+
+ # Regression test for #1596
+ context "does not break the per-item shipping method calculator", :js => true do
+ before do
+ Factory(:payment_method)
+ Spree::ShippingMethod.delete_all
+ shipping_method = Factory(:shipping_method)
+ calculator = Spree::Calculator::PerItem.create!({:calculable => shipping_method}, :without_protection => true)
+ shipping_method.calculator = calculator
+ shipping_method.save
+
+ @product.shipping_category = shipping_method.shipping_category
+ @product.save!
+ end
+
+ specify do
+ visit spree.root_path
+ click_link "RoR Mug"
+ click_button "add-to-cart-button"
+ click_link "Checkout"
+ Spree::Order.last.update_attribute(:email, "ryan@spreecommerce.com")
+
+ address = "order_bill_address_attributes"
+ fill_in "#{address}_firstname", :with => "Ryan"
+ fill_in "#{address}_lastname", :with => "Bigg"
+ fill_in "#{address}_address1", :with => "143 Swan Street"
+ fill_in "#{address}_city", :with => "Richmond"
+ select "United States", :from => "#{address}_country_id"
+ select "Alabama", :from => "#{address}_state_id"
+ fill_in "#{address}_zipcode", :with => "12345"
+ fill_in "#{address}_phone", :with => "(555) 5555-555"
+
+ check "Use Billing Address"
+ click_button "Save and Continue"
+ page.should_not have_content("undefined method `promotion'")
+ page!
+ end
+
+ end
end
end
end

0 comments on commit aae01aa

Please sign in to comment.