mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Remove without_protection: true argument from #create calls
Needed for using Strong Parameters in Rails 4
This commit is contained in:
@@ -62,7 +62,7 @@ module Spree
|
||||
payment_method: payment_method,
|
||||
amount: refund_amount.abs * -1,
|
||||
response_code: response.authorization,
|
||||
state: 'completed' }, without_protection: true)
|
||||
state: 'completed' })
|
||||
else
|
||||
gateway_error(response)
|
||||
end
|
||||
|
||||
@@ -10,6 +10,6 @@ class RemoveShippingMethodsUsingItemwiseCalculator < ActiveRecord::Migration
|
||||
end
|
||||
|
||||
def down
|
||||
Spree::ShippingMethod.create!({name: 'Delivery', zone: Spree::Zone.last, calculator: OpenFoodNetwork::Calculator::Itemwise.new}, without_protection: true)
|
||||
Spree::ShippingMethod.create!({name: 'Delivery', zone: Spree::Zone.last, calculator: OpenFoodNetwork::Calculator::Itemwise.new})
|
||||
end
|
||||
end
|
||||
|
||||
@@ -41,10 +41,7 @@ states.each do |state|
|
||||
puts "State: " + state.to_s
|
||||
|
||||
unless Spree::State.find_by(name: state['name'])
|
||||
Spree::State.create!(
|
||||
{ name: state['name'], abbr: state['abbr'], country: country },
|
||||
without_protection: true
|
||||
)
|
||||
Spree::State.create!({ name: state['name'], abbr: state['abbr'], country: country })
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ module OpenFoodNetwork
|
||||
option_type = product.variant_unit_option_type
|
||||
if option_type
|
||||
name = option_value_name
|
||||
ov = Spree::OptionValue.where(option_type_id: option_type, name: name, presentation: name).first || Spree::OptionValue.create!({ option_type: option_type, name: name, presentation: name }, without_protection: true)
|
||||
ov = Spree::OptionValue.where(option_type_id: option_type, name: name, presentation: name).first || Spree::OptionValue.create!({ option_type: option_type, name: name, presentation: name })
|
||||
option_values << ov
|
||||
end
|
||||
end
|
||||
|
||||
@@ -10,9 +10,9 @@ feature "Registration", js: true do
|
||||
before do
|
||||
Spree::Config.enterprises_require_tos = false
|
||||
|
||||
albania = Spree::Country.create!({ name: "Albania", iso3: "ALB", iso: "AL", iso_name: "ALBANIA", numcode: "8" }, without_protection: true)
|
||||
Spree::State.create!({ name: "Berat", abbr: "BRA", country: albania }, without_protection: true)
|
||||
Spree::Country.create!({ name: "Chad", iso3: "TCD", iso: "TD", iso_name: "CHAD", numcode: "148" }, without_protection: true)
|
||||
albania = Spree::Country.create!({ name: "Albania", iso3: "ALB", iso: "AL", iso_name: "ALBANIA", numcode: "8" })
|
||||
Spree::State.create!({ name: "Berat", abbr: "BRA", country: albania })
|
||||
Spree::Country.create!({ name: "Chad", iso3: "TCD", iso: "TD", iso_name: "CHAD", numcode: "148" })
|
||||
end
|
||||
|
||||
after do
|
||||
|
||||
@@ -130,7 +130,7 @@ describe EnterpriseFee do
|
||||
source: order,
|
||||
originator: tax_rate,
|
||||
state: 'closed',
|
||||
label: 'hello' }, without_protection: true)
|
||||
label: 'hello' })
|
||||
|
||||
expect do
|
||||
EnterpriseFee.clear_all_adjustments_on_order order
|
||||
|
||||
@@ -450,9 +450,9 @@ module Spree
|
||||
pb = Spree::Property.create! name: 'B', presentation: 'B'
|
||||
pc = Spree::Property.create! name: 'C', presentation: 'C'
|
||||
|
||||
product.product_properties.create!({ property_id: pa.id, value: '1', position: 1 }, without_protection: true)
|
||||
product.product_properties.create!({ property_id: pc.id, value: '3', position: 3 }, without_protection: true)
|
||||
supplier.producer_properties.create!({ property_id: pb.id, value: '2', position: 2 }, without_protection: true)
|
||||
product.product_properties.create!({ property_id: pa.id, value: '1', position: 1 })
|
||||
product.product_properties.create!({ property_id: pc.id, value: '3', position: 3 })
|
||||
supplier.producer_properties.create!({ property_id: pb.id, value: '2', position: 2 })
|
||||
|
||||
expect(product.properties_including_inherited).to eq(
|
||||
[{ id: pa.id, name: "A", value: '1' },
|
||||
|
||||
@@ -31,7 +31,7 @@ describe TagRule::DiscountOrder, type: :model do
|
||||
|
||||
pending "determining whether a the rule has already been applied to an order" do
|
||||
let!(:order) { create(:order) }
|
||||
let!(:adjustment) { order.adjustments.create({ amount: 12.34, source: order, originator: tag_rule, label: 'discount' }, without_protection: true) }
|
||||
let!(:adjustment) { order.adjustments.create({ amount: 12.34, source: order, originator: tag_rule, label: 'discount' }) }
|
||||
|
||||
before do
|
||||
tag_rule.context = { subject: order }
|
||||
|
||||
@@ -6,10 +6,10 @@
|
||||
# You can add more entries here if you need them for your tests.
|
||||
|
||||
if Spree::Country.where(nil).empty?
|
||||
Spree::Country.create!({ "name" => "Australia", "iso3" => "AUS", "iso" => "AU", "iso_name" => "AUSTRALIA", "numcode" => "36" }, without_protection: true)
|
||||
Spree::Country.create!({ "name" => "Australia", "iso3" => "AUS", "iso" => "AU", "iso_name" => "AUSTRALIA", "numcode" => "36" })
|
||||
country = Spree::Country.find_by(name: 'Australia')
|
||||
Spree::State.create!({ "name" => "Victoria", "abbr" => "Vic", :country => country }, without_protection: true)
|
||||
Spree::State.create!({ "name" => "New South Wales", "abbr" => "NSW", :country => country }, without_protection: true)
|
||||
Spree::State.create!({ "name" => "Victoria", "abbr" => "Vic", :country => country })
|
||||
Spree::State.create!({ "name" => "New South Wales", "abbr" => "NSW", :country => country })
|
||||
end
|
||||
|
||||
# Since the country seeding differs from other environments, the default
|
||||
|
||||
Reference in New Issue
Block a user