diff --git a/app/helpers/spree/api/api_helpers.rb b/app/helpers/spree/api/api_helpers.rb index 094d726336..e27d1164aa 100644 --- a/app/helpers/spree/api/api_helpers.rb +++ b/app/helpers/spree/api/api_helpers.rb @@ -2,7 +2,7 @@ module Spree module Api module ApiHelpers def required_fields_for(model) - required_fields = model._validators.select do |field, validations| + required_fields = model._validators.select do |_field, validations| validations.any? { |v| v.is_a?(ActiveModel::Validations::PresenceValidator) } end.map(&:first) # get fields that are invalid # Permalinks presence is validated, but are really automatically generated @@ -87,7 +87,7 @@ module Spree def adjustment_attributes [:id, :source_type, :source_id, :adjustable_type, :adjustable_id, :originator_type, - :originator_id, :amount, :label, :mandatory, :locked, :eligible, :created_at, :updated_at] + :originator_id, :amount, :label, :mandatory, :locked, :eligible, :created_at, :updated_at] end def creditcard_attributes @@ -118,4 +118,3 @@ module Spree end end end - diff --git a/spec/factories/shipping_method_factory.rb b/spec/factories/shipping_method_factory.rb index c98a62bf76..516dfb6b66 100644 --- a/spec/factories/shipping_method_factory.rb +++ b/spec/factories/shipping_method_factory.rb @@ -41,6 +41,6 @@ FactoryBot.modify do factory :shipping_method, parent: :base_shipping_method do distributors { [Enterprise.is_distributor.first || FactoryBot.create(:distributor_enterprise)] } display_on '' - zones { |a| [] } + zones { [] } end end diff --git a/spec/models/spree/order_spec.rb b/spec/models/spree/order_spec.rb index 4327d5e782..893e450eff 100644 --- a/spec/models/spree/order_spec.rb +++ b/spec/models/spree/order_spec.rb @@ -385,7 +385,7 @@ describe Spree::Order do let(:distributor) { create(:distributor_enterprise) } let(:order_cycle) do - create(:order_cycle).tap do |record| + create(:order_cycle).tap do create(:exchange, variants: [v1], incoming: true) create(:exchange, variants: [v1], incoming: false, receiver: distributor) end diff --git a/spec/support/controller_hacks.rb b/spec/support/controller_hacks.rb index d57123c5bf..7645e87372 100644 --- a/spec/support/controller_hacks.rb +++ b/spec/support/controller_hacks.rb @@ -1,28 +1,34 @@ require 'active_support/all' module ControllerHacks - def api_get(action, params={}, session=nil, flash=nil) + def api_get(action, params = {}, session = nil, flash = nil) api_process(action, params, session, flash, "GET") end - def api_post(action, params={}, session=nil, flash=nil) + def api_post(action, params = {}, session = nil, flash = nil) api_process(action, params, session, flash, "POST") end - def api_put(action, params={}, session=nil, flash=nil) + def api_put(action, params = {}, session = nil, flash = nil) api_process(action, params, session, flash, "PUT") end - def api_delete(action, params={}, session=nil, flash=nil) + def api_delete(action, params = {}, session = nil, flash = nil) api_process(action, params, session, flash, "DELETE") end - def api_process(action, params={}, session=nil, flash=nil, method="get") + def api_process(action, params = {}, session = nil, flash = nil, method = "get") scoping = respond_to?(:resource_scoping) ? resource_scoping : {} - process(action, params.merge(scoping).reverse_merge!(:use_route => :spree, :format => :json), session, flash, method) + process(action, + params. + merge(scoping). + reverse_merge!(use_route: :spree, format: :json), + session, + flash, + method) end end RSpec.configure do |config| - config.include ControllerHacks, :type => :controller + config.include ControllerHacks, type: :controller end diff --git a/spec/support/i18n_error_raising.rb b/spec/support/i18n_error_raising.rb index 9cef014820..9d0610b6c3 100644 --- a/spec/support/i18n_error_raising.rb +++ b/spec/support/i18n_error_raising.rb @@ -1,5 +1,5 @@ # From: https://robots.thoughtbot.com/better-tests-through-internationalization -I18n.exception_handler = lambda do |exception, locale, key, options| +I18n.exception_handler = lambda do |_exception, _locale, key, _options| raise "missing translation: #{key}" end diff --git a/spec/support/products_helper.rb b/spec/support/products_helper.rb index 24ef6bfcac..fcadc55b62 100644 --- a/spec/support/products_helper.rb +++ b/spec/support/products_helper.rb @@ -11,17 +11,17 @@ module OpenFoodNetwork shared_examples "modifying product actions are restricted" do it "cannot create a new product if not an admin" do - api_post :create, :product => { :name => "Brand new product!" } + api_post :create, product: { name: "Brand new product!" } assert_unauthorized! end it "cannot update a product" do - api_put :update, :id => product.to_param, :product => { :name => "I hacked your store!" } + api_put :update, id: product.to_param, product: { name: "I hacked your store!" } assert_unauthorized! end it "cannot delete a product" do - api_delete :destroy, :id => product.to_param + api_delete :destroy, id: product.to_param assert_unauthorized! end end