Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mass assignment exception when creating a promo code that creates a line item #1587

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions promo/app/models/spree/promotion_action.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ class PromotionAction < ActiveRecord::Base


scope :of_type, lambda {|t| {:conditions => {:type => t}}} scope :of_type, lambda {|t| {:conditions => {:type => t}}}


attr_accessible :line_items_string

# This method should be overriden in subclass # This method should be overriden in subclass
# Updates the state of the order or performs some other action depending on the 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 # options will contain the payload from the event that activated the promotion. This will include
Expand Down
15 changes: 15 additions & 0 deletions promo/spec/requests/promotion_adjustments_spec.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -295,6 +295,21 @@


end 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 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" fill_in "Name", :with => "Spend over $50 and save $5"
select "Order contents changed", :from => "Event" select "Order contents changed", :from => "Event"
Expand Down