Permalink
Browse files

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

…es a line item.


Closes #1587
  • Loading branch information...
1 parent 806396f commit 1e1874e989d06c427e5da1faa5ef9b3bc0101ecb @mscottford mscottford committed with radar May 23, 2012
Showing with 17 additions and 0 deletions.
  1. +2 −0 promo/app/models/spree/promotion_action.rb
  2. +15 −0 promo/spec/requests/promotion_adjustments_spec.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
@@ -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"

0 comments on commit 1e1874e

Please sign in to comment.