Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixes mass assignment exception when creating a promo code that creat…

…es a line item.

Closes #1587
  • Loading branch information...
commit 1e1874e989d06c427e5da1faa5ef9b3bc0101ecb 1 parent 806396f
@mscottford mscottford authored radar committed
View
2  promo/app/models/spree/promotion_action.rb
@@ -6,6 +6,8 @@ class PromotionAction < ActiveRecord::Base
scope :of_type, lambda {|t| {:conditions => {:type => t}}}
+ attr_accessible :line_items_string
+
# This method should be overriden in subclass
# Updates the state of the order or performs some other action depending on the subclass
# options will contain the payload from the event that activated the promotion. This will include
View
15 promo/spec/requests/promotion_adjustments_spec.rb
@@ -291,6 +291,21 @@
end
+ it "should allow an admin to create a promotion that adds an item to the cart" do
+ fill_in "Name", :with => "Bundle"
+ select "Coupon code added", :from => "Event"
+ fill_in "Code", :with => "5ZHED2DH"
+ click_button "Create"
+ page.should have_content("Editing Promotion")
+
+ select "Create line items", :from => "Add action of type"
+ within('#action_fields') do
+ click_button "Add"
+ click_button "Update"
+ end
+ page.should_not have_content("Can't mass-assign protected attributes: line_items_string")
+ end
+
it "ceasing to be eligible for a promotion with item total rule then becoming eligible again" do
fill_in "Name", :with => "Spend over $50 and save $5"
select "Order contents changed", :from => "Event"
Please sign in to comment.
Something went wrong with that request. Please try again.