Remove without_protection: true argument from #create calls

Needed for using Strong Parameters in Rails 4
This commit is contained in:
Matt-Yorkley
2019-12-21 22:19:06 +01:00
parent 3896644a04
commit f5bc120fb1
9 changed files with 15 additions and 18 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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' },

View File

@@ -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 }

View File

@@ -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