diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 5e26839acb7..bcd89019662 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -875,36 +875,6 @@ Style/HashLikeCase: # SupportedShorthandSyntax: always, never, either, consistent Style/HashSyntax: Exclude: - - 'spec/models/spree/product_spec.rb' - - 'spec/models/spree/return_authorization_spec.rb' - - 'spec/models/spree/shipment_spec.rb' - - 'spec/models/spree/shipping_method_spec.rb' - - 'spec/models/spree/shipping_rate_spec.rb' - - 'spec/models/spree/stock/availability_validator_spec.rb' - - 'spec/models/spree/stock_movement_spec.rb' - - 'spec/models/spree/tax_rate_spec.rb' - - 'spec/models/spree/user_spec.rb' - - 'spec/models/spree/variant_spec.rb' - - 'spec/models/spree/zone_spec.rb' - - 'spec/models/stripe_account_spec.rb' - - 'spec/models/variant_override_spec.rb' - - 'spec/models/voucher_spec.rb' - - 'spec/queries/complete_orders_with_balance_spec.rb' - - 'spec/queries/customers_with_balance_spec.rb' - - 'spec/queries/outstanding_balance_spec.rb' - - 'spec/queries/payments_requiring_action_spec.rb' - - 'spec/requests/api/v1/customers_spec.rb' - - 'spec/requests/checkout/failed_checkout_spec.rb' - - 'spec/requests/checkout/paypal_spec.rb' - - 'spec/requests/checkout/routes_spec.rb' - - 'spec/requests/checkout/stripe_sca_spec.rb' - - 'spec/requests/voucher_adjustments_spec.rb' - - 'spec/serializers/api/admin/customer_serializer_spec.rb' - - 'spec/serializers/api/admin/for_order_cycle/supplied_product_serializer_spec.rb' - - 'spec/serializers/api/admin/index_enterprise_serializer_spec.rb' - - 'spec/serializers/api/admin/order_serializer_spec.rb' - - 'spec/serializers/api/admin/variant_override_serializer_spec.rb' - - 'spec/serializers/api/enterprise_serializer_spec.rb' - 'spec/serializers/api/order_serializer_spec.rb' - 'spec/serializers/api/product_serializer_spec.rb' - 'spec/services/cap_quantity_spec.rb' diff --git a/spec/models/spree/product_spec.rb b/spec/models/spree/product_spec.rb index b006d10fecc..06ba1e2626f 100644 --- a/spec/models/spree/product_spec.rb +++ b/spec/models/spree/product_spec.rb @@ -19,7 +19,7 @@ module Spree context "product has variants" do before do - product.reload.variants << create(:variant, product: product) + product.reload.variants << create(:variant, product:) end context "#destroy" do @@ -148,7 +148,7 @@ module Spree let(:stock_item) { variant.stock_items.first } it "doesnt raise ReadOnlyRecord error" do - Spree::StockMovement.create!(stock_item: stock_item, quantity: 1) + Spree::StockMovement.create!(stock_item:, quantity: 1) expect { product.destroy }.not_to raise_error end end @@ -195,7 +195,7 @@ module Spree context "when the product has variants" do let(:product) do product = create(:simple_product) - create(:variant, product: product) + create(:variant, product:) product.reload end @@ -512,7 +512,7 @@ module Spree it "shows only products for given user" do user = create(:user) user.spree_roles = [] - @e1.enterprise_roles.build(user: user).save + @e1.enterprise_roles.build(user:).save product = Product.managed_by user expect(product.count).to eq(1) @@ -535,17 +535,17 @@ module Spree let!(:hidden_variant) { create(:variant) } let!(:product) { create(:product) } - let!(:visible_variant1) { create(:variant, product: product) } - let!(:visible_variant2) { create(:variant, product: product) } + let!(:visible_variant1) { create(:variant, product:) } + let!(:visible_variant2) { create(:variant, product:) } let!(:hidden_inventory_item) { - create(:inventory_item, enterprise: enterprise, variant: hidden_variant, visible: false ) + create(:inventory_item, enterprise:, variant: hidden_variant, visible: false ) } let!(:visible_inventory_item1) { - create(:inventory_item, enterprise: enterprise, variant: visible_variant1, visible: true ) + create(:inventory_item, enterprise:, variant: visible_variant1, visible: true ) } let!(:visible_inventory_item2) { - create(:inventory_item, enterprise: enterprise, variant: visible_variant2, visible: true ) + create(:inventory_item, enterprise:, variant: visible_variant2, visible: true ) } let!(:products) { Spree::Product.visible_for(enterprise) } @@ -604,7 +604,7 @@ module Spree it "returns producer properties as a hash" do supplier = create(:supplier_enterprise) - product = create(:simple_product, supplier: supplier) + product = create(:simple_product, supplier:) supplier.set_producer_property 'Organic Certified', 'NASAA 54321' property = supplier.properties.last @@ -616,7 +616,7 @@ module Spree it "overrides producer properties with product properties" do supplier = create(:supplier_enterprise) - product = create(:simple_product, supplier: supplier) + product = create(:simple_product, supplier:) product.set_property 'Organic Certified', 'NASAA 12345' supplier.set_producer_property 'Organic Certified', 'NASAA 54321' @@ -629,7 +629,7 @@ module Spree context "when product has an inherit_properties value set to true" do let(:supplier) { create(:supplier_enterprise) } - let(:product) { create(:simple_product, supplier: supplier, inherits_properties: true) } + let(:product) { create(:simple_product, supplier:, inherits_properties: true) } it "inherits producer properties" do supplier.set_producer_property 'Organic Certified', 'NASAA 54321' @@ -643,7 +643,7 @@ module Spree context "when product has an inherit_properties value set to false" do let(:supplier) { create(:supplier_enterprise) } - let(:product) { create(:simple_product, supplier: supplier, inherits_properties: false) } + let(:product) { create(:simple_product, supplier:, inherits_properties: false) } it "does not inherit producer properties" do supplier.set_producer_property 'Organic Certified', 'NASAA 54321' @@ -654,7 +654,7 @@ module Spree it "sorts by position" do supplier = create(:supplier_enterprise) - product = create(:simple_product, supplier: supplier) + product = create(:simple_product, supplier:) pa = Spree::Property.create! name: 'A', presentation: 'A' pb = Spree::Property.create! name: 'B', presentation: 'B' @@ -748,8 +748,8 @@ module Spree end context "when the variants do not have an import date" do - let!(:variant_a) { create(:variant, product: product, import_date: nil) } - let!(:variant_b) { create(:variant, product: product, import_date: nil) } + let!(:variant_a) { create(:variant, product:, import_date: nil) } + let!(:variant_b) { create(:variant, product:, import_date: nil) } it "returns nil" do expect(product.import_date).to be_nil @@ -757,12 +757,12 @@ module Spree end context "when some variants have import date and some do not" do - let!(:variant_a) { create(:variant, product: product, import_date: nil) } + let!(:variant_a) { create(:variant, product:, import_date: nil) } let!(:variant_b) { - create(:variant, product: product, import_date: reference_time - 1.hour) + create(:variant, product:, import_date: reference_time - 1.hour) } let!(:variant_c) { - create(:variant, product: product, import_date: reference_time - 2.hours) + create(:variant, product:, import_date: reference_time - 2.hours) } it "returns the most recent import date" do @@ -772,13 +772,13 @@ module Spree context "when all variants have import date" do let!(:variant_a) { - create(:variant, product: product, import_date: reference_time - 2.hours) + create(:variant, product:, import_date: reference_time - 2.hours) } let!(:variant_b) { - create(:variant, product: product, import_date: reference_time - 1.hour) + create(:variant, product:, import_date: reference_time - 1.hour) } let!(:variant_c) { - create(:variant, product: product, import_date: reference_time - 3.hours) + create(:variant, product:, import_date: reference_time - 3.hours) } it "returns the most recent import date" do diff --git a/spec/models/spree/return_authorization_spec.rb b/spec/models/spree/return_authorization_spec.rb index fb5bb41a3b2..fe87f15f0c2 100644 --- a/spec/models/spree/return_authorization_spec.rb +++ b/spec/models/spree/return_authorization_spec.rb @@ -5,7 +5,7 @@ describe Spree::ReturnAuthorization do let(:order) { create(:shipped_order) } let(:variant) { order.shipments.first.inventory_units.first.variant } - let(:return_authorization) { Spree::ReturnAuthorization.new(order: order) } + let(:return_authorization) { Spree::ReturnAuthorization.new(order:) } context "save" do it "should be invalid when order has no inventory units" do @@ -87,7 +87,7 @@ expect(Spree::Adjustment).to receive(:create).with( amount: -20, label: 'RMA credit', - order: order, + order:, adjustable: order, originator: return_authorization ) diff --git a/spec/models/spree/shipment_spec.rb b/spec/models/spree/shipment_spec.rb index d9c4c5f295c..114fb6d8cab 100644 --- a/spec/models/spree/shipment_spec.rb +++ b/spec/models/spree/shipment_spec.rb @@ -7,8 +7,8 @@ let(:order) { build(:order) } let(:shipping_method) { build(:shipping_method, name: "UPS") } let(:shipment) do - shipment = Spree::Shipment.new order: order - allow(shipment).to receive_messages(shipping_method: shipping_method) + shipment = Spree::Shipment.new(order:) + allow(shipment).to receive_messages(shipping_method:) shipment.state = 'pending' shipment end @@ -106,7 +106,7 @@ end context 'refresh_rates' do - let(:mock_estimator) { double('estimator', shipping_rates: shipping_rates) } + let(:mock_estimator) { double('estimator', shipping_rates:) } it 'should request new rates, and maintain shipping_method selection' do expect(OrderManagement::Stock::Estimator). @@ -143,13 +143,13 @@ includes: [ build_stubbed( :inventory_unit, - shipment: shipment, + shipment:, variant: build_stubbed(:variant), state: 'on_hand' ), build_stubbed( :inventory_unit, - shipment: shipment, + shipment:, variant: build_stubbed(:variant), state: 'backordered' ) @@ -288,7 +288,7 @@ end it 'restocks the items' do - unit = double(:inventory_unit, variant: variant) + unit = double(:inventory_unit, variant:) allow(unit).to receive(:quantity) { 1 } allow(shipment).to receive_message_chain(:inventory_units, :group_by, @@ -312,7 +312,7 @@ end it 'unstocks the items' do - unit = create(:inventory_unit, variant: variant) + unit = create(:inventory_unit, variant:) allow(unit).to receive(:quantity) { 1 } allow(shipment).to receive_message_chain(:inventory_units, :group_by, @@ -463,7 +463,7 @@ { variant_id: variant.id, state: 'on_hand', order_id: order.id } end - before { allow(shipment).to receive_messages inventory_units: inventory_units } + before { allow(shipment).to receive_messages(inventory_units:) } it "associates variant and order" do expect(inventory_units).to receive(:create).with(params) diff --git a/spec/models/spree/shipping_method_spec.rb b/spec/models/spree/shipping_method_spec.rb index ec34bf35701..a7b12354995 100644 --- a/spec/models/spree/shipping_method_spec.rb +++ b/spec/models/spree/shipping_method_spec.rb @@ -208,7 +208,7 @@ module Spree let!(:shipping_method) { create(:shipping_method) } let!(:shipment) do shipment = create(:shipment) - shipment.shipping_rates.create!(shipping_method: shipping_method) + shipment.shipping_rates.create!(shipping_method:) shipment end diff --git a/spec/models/spree/shipping_rate_spec.rb b/spec/models/spree/shipping_rate_spec.rb index d071b15c3ca..5090d285e91 100644 --- a/spec/models/spree/shipping_rate_spec.rb +++ b/spec/models/spree/shipping_rate_spec.rb @@ -6,8 +6,8 @@ let(:shipment) { create(:shipment) } let(:shipping_method) { build_stubbed(:shipping_method) } let(:shipping_rate) { - Spree::ShippingRate.new(shipment: shipment, - shipping_method: shipping_method, + Spree::ShippingRate.new(shipment:, + shipping_method:, cost: 10.55) } diff --git a/spec/models/spree/stock/availability_validator_spec.rb b/spec/models/spree/stock/availability_validator_spec.rb index 385ffd46e23..e2f03027d5a 100644 --- a/spec/models/spree/stock/availability_validator_spec.rb +++ b/spec/models/spree/stock/availability_validator_spec.rb @@ -58,7 +58,7 @@ module Stock let(:variant) { line_item.variant } let(:vo_stock) { 999 } let!(:variant_override) { - create(:variant_override, variant: variant, hub: hub, count_on_hand: vo_stock) + create(:variant_override, variant:, hub:, count_on_hand: vo_stock) } context "when the override has stock" do diff --git a/spec/models/spree/stock_movement_spec.rb b/spec/models/spree/stock_movement_spec.rb index 2da7976c57f..95f0ea5564d 100644 --- a/spec/models/spree/stock_movement_spec.rb +++ b/spec/models/spree/stock_movement_spec.rb @@ -5,7 +5,7 @@ describe Spree::StockMovement do let(:stock_location) { create(:stock_location_with_items) } let(:stock_item) { stock_location.stock_items.order(:id).first } - subject { build(:stock_movement, stock_item: stock_item) } + subject { build(:stock_movement, stock_item:) } it 'should belong to a stock item' do expect(subject).to respond_to(:stock_item) diff --git a/spec/models/spree/tax_rate_spec.rb b/spec/models/spree/tax_rate_spec.rb index 6cf0da7e483..e22fb9829cd 100644 --- a/spec/models/spree/tax_rate_spec.rb +++ b/spec/models/spree/tax_rate_spec.rb @@ -9,7 +9,7 @@ module Spree let!(:order) { create(:order, distributor: hub, bill_address: create(:address)) } let!(:tax_rate) { create(:tax_rate, included_in_price: true, - calculator: ::Calculator::FlatRate.new(preferred_amount: 0.1), zone: zone) + calculator: ::Calculator::FlatRate.new(preferred_amount: 0.1), zone:) } describe "when the order's hub charges sales tax" do @@ -69,8 +69,8 @@ module Spree rate = Spree::TaxRate.create( amount: 1, zone: @zone, - tax_category: tax_category, - calculator: calculator + tax_category:, + calculator: ) allow(order).to receive(:tax_zone) { @zone } @@ -82,14 +82,14 @@ module Spree rate1 = Spree::TaxRate.create( amount: 1, zone: @zone, - tax_category: tax_category, - calculator: calculator + tax_category:, + calculator: ) rate2 = Spree::TaxRate.create( amount: 2, zone: @zone, - tax_category: tax_category, + tax_category:, calculator: ::Calculator::FlatRate.new ) @@ -101,14 +101,14 @@ module Spree context "when the tax_zone is contained within a rate zone" do before do sub_zone = create(:zone, name: "State Zone", zone_members: []) - sub_zone.zone_members.create(zoneable: create(:state, country: country)) + sub_zone.zone_members.create(zoneable: create(:state, country:)) allow(order).to receive(:tax_zone) { sub_zone } @rate = Spree::TaxRate.create( amount: 1, zone: @zone, - tax_category: tax_category, - calculator: calculator + tax_category:, + calculator: ) end @@ -128,9 +128,9 @@ module Spree let!(:rate) do Spree::TaxRate.create(amount: 1, zone: @zone, - tax_category: tax_category, - calculator: calculator, - included_in_price: included_in_price) + tax_category:, + calculator:, + included_in_price:) end subject { Spree::TaxRate.match(order) } @@ -224,7 +224,7 @@ module Spree end context "with shipments" do - let(:shipment) { build_stubbed(:shipment, order: order) } + let(:shipment) { build_stubbed(:shipment, order:) } let(:shipments) { [shipment] } before do @@ -264,8 +264,8 @@ module Spree rate = Spree::TaxRate.create( amount: 1, zone: @zone, - tax_category: tax_category, - calculator: calculator + tax_category:, + calculator: ) end @@ -284,18 +284,18 @@ module Spree describe "#adjust" do let!(:country) { create(:country, name: "Default Country") } - let!(:state) { create(:state, name: "Default State", country: country) } + let!(:state) { create(:state, name: "Default State", country:) } let!(:zone) { create(:zone_with_member, default_tax: true, member: country ) } let!(:category) { create(:tax_category, name: "Taxable Foo") } let!(:category2) { create(:tax_category, name: "Non Taxable") } let!(:rate1) { - create(:tax_rate, amount: 0.10, zone: zone, tax_category: category) + create(:tax_rate, amount: 0.10, zone:, tax_category: category) } let!(:rate2) { - create(:tax_rate, amount: 0.05, zone: zone, tax_category: category) + create(:tax_rate, amount: 0.05, zone:, tax_category: category) } let(:hub) { create(:distributor_enterprise, charges_sales_tax: true) } - let(:address) { create(:address, state: country.states.first, country: country) } + let(:address) { create(:address, state: country.states.first, country:) } let!(:order) { create(:order_with_line_items, line_items_count: 2, distributor: hub, ship_address: address) @@ -393,7 +393,7 @@ module Spree before do allow(order).to receive(:tax_zone) { zone } [rate1, rate2].each do |rate| - rate.update(included_in_price: false, zone: zone) + rate.update(included_in_price: false, zone:) end Spree::TaxRate.adjust(order, order.line_items) diff --git a/spec/models/spree/user_spec.rb b/spec/models/spree/user_spec.rb index 53700326ad4..cc1284d0505 100644 --- a/spec/models/spree/user_spec.rb +++ b/spec/models/spree/user_spec.rb @@ -128,10 +128,10 @@ let(:email) { generate(:random_email) } let(:enterprise1) { create(:enterprise) } let(:enterprise2) { create(:enterprise) } - let!(:customer1) { create(:customer, user: nil, email: email, enterprise: enterprise1) } - let!(:customer2) { create(:customer, user: nil, email: email, enterprise: enterprise2) } + let!(:customer1) { create(:customer, user: nil, email:, enterprise: enterprise1) } + let!(:customer2) { create(:customer, user: nil, email:, enterprise: enterprise2) } let!(:order) { create(:order, customer: customer1) } - let!(:user) { create(:user, email: email) } + let!(:user) { create(:user, email:) } it "should associate these customers with the created user" do expect(user.customers.reload).to include customer1, customer2 @@ -190,7 +190,7 @@ end context "when the user has one credit card" do - let!(:card) { create(:stored_credit_card, user: user) } + let!(:card) { create(:stored_credit_card, user:) } it "should be assigned as the default and be returned" do expect(card.reload.is_default).to be true @@ -199,8 +199,8 @@ end context "when the user has more than one card" do - let!(:non_default_card) { create(:stored_credit_card, user: user) } - let!(:default_card) { create(:stored_credit_card, user: user, is_default: true) } + let!(:non_default_card) { create(:stored_credit_card, user:) } + let!(:default_card) { create(:stored_credit_card, user:, is_default: true) } it "returns the card which is specified as the default" do expect(user.default_card.id).to be default_card.id diff --git a/spec/models/spree/variant_spec.rb b/spec/models/spree/variant_spec.rb index f0d0e10473b..6897a220e0d 100644 --- a/spec/models/spree/variant_spec.rb +++ b/spec/models/spree/variant_spec.rb @@ -107,7 +107,7 @@ describe '.price_in' do before do - variant.prices << create(:price, variant: variant, currency: "EUR", amount: 33.33) + variant.prices << create(:price, variant:, currency: "EUR", amount: 33.33) end subject { variant.price_in(currency).display_amount } @@ -138,7 +138,7 @@ describe '.amount_in' do before do - variant.prices << create(:price, variant: variant, currency: "EUR", amount: 33.33) + variant.prices << create(:price, variant:, currency: "EUR", amount: 33.33) end subject { variant.amount_in(currency) } @@ -324,10 +324,10 @@ let!(:visible_variant) { create(:variant) } let!(:hidden_inventory_item) { - create(:inventory_item, enterprise: enterprise, variant: hidden_variant, visible: false ) + create(:inventory_item, enterprise:, variant: hidden_variant, visible: false ) } let!(:visible_inventory_item) { - create(:inventory_item, enterprise: enterprise, variant: visible_variant, visible: true ) + create(:inventory_item, enterprise:, variant: visible_variant, visible: true ) } context "finding variants that are not hidden from an enterprise's inventory" do @@ -509,7 +509,7 @@ context "when the product has variants" do let!(:product) { create(:simple_product) } - let!(:variant) { create(:variant, product: product) } + let!(:variant) { create(:variant, product:) } %w(weight volume).each do |unit| context "when the product's unit is #{unit}" do diff --git a/spec/models/spree/zone_spec.rb b/spec/models/spree/zone_spec.rb index 17de82cae07..ce28024cafd 100644 --- a/spec/models/spree/zone_spec.rb +++ b/spec/models/spree/zone_spec.rb @@ -8,14 +8,14 @@ let(:country) do country = create(:country) # Create at least one state for this country - state = create(:state, country: country) + state = create(:state, country:) country end before { country_zone.members.create(zoneable: country) } context "when there is only one qualifying zone" do - let(:address) { create(:address, country: country, state: country.states.first) } + let(:address) { create(:address, country:, state: country.states.first) } it "should return the qualifying zone" do expect(Spree::Zone.match(address)).to eq country_zone @@ -23,7 +23,7 @@ end context "when there are two qualified zones with same member type" do - let(:address) { create(:address, country: country, state: country.states.first) } + let(:address) { create(:address, country:, state: country.states.first) } let(:second_zone) { create(:zone, name: 'SecondZone') } before { second_zone.members.create(zoneable: country) } @@ -47,7 +47,7 @@ context "when there are two qualified zones with different member types" do let(:state_zone) { create(:zone, name: 'StateZone') } - let(:address) { create(:address, country: country, state: country.states.first) } + let(:address) { create(:address, country:, state: country.states.first) } before { state_zone.members.create(zoneable: country.states.first) } @@ -91,7 +91,7 @@ context "#contains_address?" do let(:state) { create(:state) } let(:country) { state.country } - let(:address) { create(:address, country: country, state: state) } + let(:address) { create(:address, country:, state:) } context "when zone is country type" do let(:country_zone) { create(:zone, name: 'CountryZone') } diff --git a/spec/models/stripe_account_spec.rb b/spec/models/stripe_account_spec.rb index 0a95a2ddcde..f798cbc56a4 100644 --- a/spec/models/stripe_account_spec.rb +++ b/spec/models/stripe_account_spec.rb @@ -10,7 +10,7 @@ let(:client_id) { 'ca_abc123' } let(:stripe_user_id) { 'acct_abc123' } let!(:stripe_account) { - create(:stripe_account, enterprise: enterprise, stripe_user_id: stripe_user_id) + create(:stripe_account, enterprise:, stripe_user_id:) } before do @@ -37,7 +37,7 @@ before do stub_request(:post, "https://connect.stripe.com/oauth/deauthorize"). with(body: { "client_id" => client_id, "stripe_user_id" => stripe_user_id }). - to_return(status: 200, body: JSON.generate(stripe_user_id: stripe_user_id)) + to_return(status: 200, body: JSON.generate(stripe_user_id:)) end it "destroys the record" do @@ -48,7 +48,7 @@ context "if the account is also associated with another Enterprise" do let!(:another_stripe_account) { - create(:stripe_account, enterprise: enterprise2, stripe_user_id: stripe_user_id) + create(:stripe_account, enterprise: enterprise2, stripe_user_id:) } it "Doesn't make a Stripe API disconnection request " do diff --git a/spec/models/variant_override_spec.rb b/spec/models/variant_override_spec.rb index 7b03fd33f2b..9ff4ba0709c 100644 --- a/spec/models/variant_override_spec.rb +++ b/spec/models/variant_override_spec.rb @@ -10,13 +10,13 @@ let(:hub1) { create(:distributor_enterprise) } let(:hub2) { create(:distributor_enterprise) } let!(:vo1) { - create(:variant_override, hub: hub1, variant: variant, import_date: Time.zone.now.yesterday) + create(:variant_override, hub: hub1, variant:, import_date: Time.zone.now.yesterday) } let!(:vo2) { - create(:variant_override, hub: hub2, variant: variant, import_date: Time.zone.now) + create(:variant_override, hub: hub2, variant:, import_date: Time.zone.now) } let!(:vo3) { - create(:variant_override, hub: hub1, variant: variant, permission_revoked_at: Time.zone.now) + create(:variant_override, hub: hub1, variant:, permission_revoked_at: Time.zone.now) } it "ignores variant_overrides with revoked_permissions by default" do @@ -55,8 +55,8 @@ :variant_override, hub: build_stubbed(:distributor_enterprise), variant: build_stubbed(:variant), - on_demand: on_demand, - count_on_hand: count_on_hand + on_demand:, + count_on_hand: ) end @@ -215,8 +215,8 @@ let(:variant_override) do create( :variant_override, - variant: variant, - hub: hub, + variant:, + hub:, count_on_hand: 12 ) end @@ -265,7 +265,7 @@ describe "resetting stock levels" do describe "forcing the on hand level to the value in the default_stock field" do it "succeeds for variant override that forces limited stock" do - vo = create(:variant_override, variant: variant, hub: hub, count_on_hand: 12, + vo = create(:variant_override, variant:, hub:, count_on_hand: 12, default_stock: 20, resettable: true) vo.reset_stock! @@ -275,7 +275,7 @@ end it "succeeds for variant override that forces unlimited stock" do - vo = create(:variant_override, :on_demand, variant: variant, hub: hub, default_stock: 20, + vo = create(:variant_override, :on_demand, variant:, hub:, default_stock: 20, resettable: true) vo.reset_stock! @@ -285,7 +285,7 @@ end it "succeeds for variant override that uses producer stock settings" do - vo = create(:variant_override, :use_producer_stock_settings, variant: variant, hub: hub, + vo = create(:variant_override, :use_producer_stock_settings, variant:, hub:, default_stock: 20, resettable: true) vo.reset_stock! @@ -297,7 +297,7 @@ end it "silently logs an error if the variant override doesn't have a default stock level" do - vo = create(:variant_override, variant: variant, hub: hub, count_on_hand: 12, + vo = create(:variant_override, variant:, hub:, count_on_hand: 12, default_stock: nil, resettable: true) expect(Bugsnag).to receive(:notify) vo.reset_stock! @@ -305,7 +305,7 @@ end it "doesn't reset the level if the behaviour is disabled" do - vo = create(:variant_override, variant: variant, hub: hub, count_on_hand: 12, + vo = create(:variant_override, variant:, hub:, count_on_hand: 12, default_stock: 10, resettable: false) vo.reset_stock! expect(vo.reload.count_on_hand).to eq(12) diff --git a/spec/models/voucher_spec.rb b/spec/models/voucher_spec.rb index a895db0da21..aef0db2194e 100644 --- a/spec/models/voucher_spec.rb +++ b/spec/models/voucher_spec.rb @@ -24,14 +24,14 @@ class TestVoucher < Voucher; end end describe 'validations' do - subject { build(:voucher_flat_rate, code: 'new_code', enterprise: enterprise) } + subject { build(:voucher_flat_rate, code: 'new_code', enterprise:) } it { is_expected.to validate_presence_of(:code) } it { is_expected.to validate_uniqueness_of(:code).scoped_to(:enterprise_id) } end describe '#display_value' do - subject(:voucher) { Vouchers::TestVoucher.new(code: 'new_code', enterprise: enterprise) } + subject(:voucher) { Vouchers::TestVoucher.new(code: 'new_code', enterprise:) } it "raises not implemented error" do expect{ voucher.display_value } @@ -40,7 +40,7 @@ class TestVoucher < Voucher; end end describe '#compute_amount' do - subject(:voucher) { Vouchers::TestVoucher.new(code: 'new_code', enterprise: enterprise) } + subject(:voucher) { Vouchers::TestVoucher.new(code: 'new_code', enterprise:) } it "raises not implemented error" do expect{ voucher.compute_amount(nil) } @@ -52,7 +52,7 @@ class TestVoucher < Voucher; end subject(:adjustment) { voucher.create_adjustment(voucher.code, order) } let(:voucher) do - create(:voucher_flat_rate, code: 'new_code', enterprise: enterprise, amount: 25) + create(:voucher_flat_rate, code: 'new_code', enterprise:, amount: 25) end let(:order) { create(:order_with_line_items, line_items_count: 3, distributor: enterprise) } @@ -70,7 +70,7 @@ class TestVoucher < Voucher; end end describe '#rate' do - subject(:voucher) { Vouchers::TestVoucher.new(code: 'new_code', enterprise: enterprise) } + subject(:voucher) { Vouchers::TestVoucher.new(code: 'new_code', enterprise:) } it "raises not implemented error" do expect{ voucher.rate(nil) } diff --git a/spec/queries/complete_orders_with_balance_spec.rb b/spec/queries/complete_orders_with_balance_spec.rb index fae8ea58819..a587153766e 100644 --- a/spec/queries/complete_orders_with_balance_spec.rb +++ b/spec/queries/complete_orders_with_balance_spec.rb @@ -16,7 +16,7 @@ let!(:other_order) do create( :order, - user: user, + user:, state: 'complete', total: 2.0, payment_total: 1.0, diff --git a/spec/queries/customers_with_balance_spec.rb b/spec/queries/customers_with_balance_spec.rb index 70dc517f1c0..7a600e94128 100644 --- a/spec/queries/customers_with_balance_spec.rb +++ b/spec/queries/customers_with_balance_spec.rb @@ -37,8 +37,8 @@ context 'when orders are in cart state' do before do - create(:order, customer: customer, total: order_total, payment_total: 0, state: 'cart') - create(:order, customer: customer, total: order_total, payment_total: 0, state: 'cart') + create(:order, customer:, total: order_total, payment_total: 0, state: 'cart') + create(:order, customer:, total: order_total, payment_total: 0, state: 'cart') end it 'returns the customer balance' do @@ -49,8 +49,8 @@ context 'when orders are in address state' do before do - create(:order, customer: customer, total: order_total, payment_total: 0, state: 'address') - create(:order, customer: customer, total: order_total, payment_total: 50, state: 'address') + create(:order, customer:, total: order_total, payment_total: 0, state: 'address') + create(:order, customer:, total: order_total, payment_total: 50, state: 'address') end it 'returns the customer balance' do @@ -61,8 +61,8 @@ context 'when orders are in delivery state' do before do - create(:order, customer: customer, total: order_total, payment_total: 0, state: 'delivery') - create(:order, customer: customer, total: order_total, payment_total: 50, state: 'delivery') + create(:order, customer:, total: order_total, payment_total: 0, state: 'delivery') + create(:order, customer:, total: order_total, payment_total: 50, state: 'delivery') end it 'returns the customer balance' do @@ -73,8 +73,8 @@ context 'when orders are in payment state' do before do - create(:order, customer: customer, total: order_total, payment_total: 0, state: 'payment') - create(:order, customer: customer, total: order_total, payment_total: 50, state: 'payment') + create(:order, customer:, total: order_total, payment_total: 0, state: 'payment') + create(:order, customer:, total: order_total, payment_total: 50, state: 'payment') end it 'returns the customer balance' do @@ -85,9 +85,9 @@ context 'when no orders where paid' do before do - order = create(:order, customer: customer, total: order_total, payment_total: 0) + order = create(:order, customer:, total: order_total, payment_total: 0) order.update_attribute(:state, 'complete') - order = create(:order, customer: customer, total: order_total, payment_total: 0) + order = create(:order, customer:, total: order_total, payment_total: 0) order.update_attribute(:state, 'complete') end @@ -101,9 +101,9 @@ let(:payment_total) { order_total } before do - order = create(:order, customer: customer, total: order_total, payment_total: 0) + order = create(:order, customer:, total: order_total, payment_total: 0) order.update_attribute(:state, 'complete') - order = create(:order, customer: customer, total: order_total, payment_total: payment_total) + order = create(:order, customer:, total: order_total, payment_total:) order.update_attribute(:state, 'complete') end @@ -118,11 +118,11 @@ let(:non_canceled_orders_total) { order_total } before do - order = create(:order, customer: customer, total: order_total, payment_total: 0) + order = create(:order, customer:, total: order_total, payment_total: 0) order.update_attribute(:state, 'complete') create( :order, - customer: customer, + customer:, total: order_total, payment_total: order_total, state: 'canceled' @@ -139,9 +139,9 @@ let(:payment_total) { order_total } before do - order = create(:order, customer: customer, total: order_total, payment_total: 0) + order = create(:order, customer:, total: order_total, payment_total: 0) order.update_attribute(:state, 'complete') - order = create(:order, customer: customer, total: order_total, payment_total: payment_total) + order = create(:order, customer:, total: order_total, payment_total:) order.update_attribute(:state, 'resumed') end @@ -155,9 +155,9 @@ let(:payment_total) { order_total } before do - order = create(:order, customer: customer, total: order_total, payment_total: 0) + order = create(:order, customer:, total: order_total, payment_total: 0) order.update_attribute(:state, 'complete') - order = create(:order, customer: customer, total: order_total, payment_total: payment_total) + order = create(:order, customer:, total: order_total, payment_total:) order.update_attribute(:state, 'payment') end @@ -171,9 +171,9 @@ let(:payment_total) { order_total } before do - order = create(:order, customer: customer, total: order_total, payment_total: 0) + order = create(:order, customer:, total: order_total, payment_total: 0) order.update_attribute(:state, 'complete') - order = create(:order, customer: customer, total: order_total, payment_total: payment_total) + order = create(:order, customer:, total: order_total, payment_total:) order.update_attribute(:state, 'awaiting_return') end @@ -188,9 +188,9 @@ let(:non_returned_orders_total) { order_total } before do - order = create(:order, customer: customer, total: order_total, payment_total: 0) + order = create(:order, customer:, total: order_total, payment_total: 0) order.update_attribute(:state, 'complete') - order = create(:order, customer: customer, total: order_total, payment_total: payment_total) + order = create(:order, customer:, total: order_total, payment_total:) order.update_attribute(:state, 'returned') end diff --git a/spec/queries/outstanding_balance_spec.rb b/spec/queries/outstanding_balance_spec.rb index 2586d4eedea..91b80f4c827 100644 --- a/spec/queries/outstanding_balance_spec.rb +++ b/spec/queries/outstanding_balance_spec.rb @@ -96,7 +96,7 @@ def normalize(sql) before do order = create(:order, total: order_total, payment_total: 0) order.update_attribute(:state, 'complete') - order = create(:order, total: order_total, payment_total: payment_total) + order = create(:order, total: order_total, payment_total:) order.update_attribute(:state, 'complete') end @@ -128,7 +128,7 @@ def normalize(sql) before do order = create(:order, total: order_total, payment_total: 0) order.update_attribute(:state, 'complete') - order = create(:order, total: order_total, payment_total: payment_total) + order = create(:order, total: order_total, payment_total:) order.update_attribute(:state, 'resumed') end @@ -144,7 +144,7 @@ def normalize(sql) before do order = create(:order, total: order_total, payment_total: 0) order.update_attribute(:state, 'complete') - order = create(:order, total: order_total, payment_total: payment_total) + order = create(:order, total: order_total, payment_total:) order.update_attribute(:state, 'payment') end @@ -160,7 +160,7 @@ def normalize(sql) before do order = create(:order, total: order_total, payment_total: 0) order.update_attribute(:state, 'complete') - order = create(:order, total: order_total, payment_total: payment_total) + order = create(:order, total: order_total, payment_total:) order.update_attribute(:state, 'awaiting_return') end @@ -175,7 +175,7 @@ def normalize(sql) let(:non_returned_orders_total) { order_total } before do - order = create(:order, total: order_total, payment_total: payment_total) + order = create(:order, total: order_total, payment_total:) order.update_attribute(:state, 'returned') order = create(:order, total: order_total, payment_total: 0) order.update_attribute(:state, 'complete') diff --git a/spec/queries/payments_requiring_action_spec.rb b/spec/queries/payments_requiring_action_spec.rb index 32958b288e5..77a9ca04049 100644 --- a/spec/queries/payments_requiring_action_spec.rb +++ b/spec/queries/payments_requiring_action_spec.rb @@ -4,14 +4,14 @@ describe PaymentsRequiringAction do let(:user) { create(:user) } - let(:order) { create(:order, user: user) } + let(:order) { create(:order, user:) } subject(:payments_requiring_action) { described_class.new(user) } describe '#query' do context "payment has a cvv_response_message" do let(:payment) do create(:payment, - order: order, + order:, cvv_response_message: "https://stripe.com/redirect", state: "requires_authorization") end @@ -23,7 +23,7 @@ context "payment has no cvv_response_message" do let(:payment) do - create(:payment, order: order, cvv_response_message: nil) + create(:payment, order:, cvv_response_message: nil) end it "does not find the payment" do diff --git a/spec/requests/api/v1/customers_spec.rb b/spec/requests/api/v1/customers_spec.rb index fe11718ac1a..002651861a3 100644 --- a/spec/requests/api/v1/customers_spec.rb +++ b/spec/requests/api/v1/customers_spec.rb @@ -80,7 +80,7 @@ context "as a user who manages the enterprise" do let!(:user){ enterprise3.users.first } before do - EnterpriseRole.create!(user: user, enterprise: enterprise1) + EnterpriseRole.create!(user:, enterprise: enterprise1) login_as user end diff --git a/spec/requests/checkout/failed_checkout_spec.rb b/spec/requests/checkout/failed_checkout_spec.rb index 7885e02c078..a1c43e9db10 100644 --- a/spec/requests/checkout/failed_checkout_spec.rb +++ b/spec/requests/checkout/failed_checkout_spec.rb @@ -8,11 +8,11 @@ let!(:shop) { create(:enterprise) } let!(:order_cycle) { create(:simple_order_cycle) } let!(:exchange) { - create(:exchange, order_cycle: order_cycle, sender: order_cycle.coordinator, receiver: shop, + create(:exchange, order_cycle:, sender: order_cycle.coordinator, receiver: shop, incoming: false, pickup_time: "Monday") } let!(:address) { create(:address) } - let!(:line_item) { create(:line_item, order: order, quantity: 3, price: 5.00) } + let!(:line_item) { create(:line_item, order:, quantity: 3, price: 5.00) } let!(:payment_method) { create(:bogus_payment_method, distributor_ids: [shop.id], environment: Rails.env) } @@ -20,9 +20,9 @@ create(:payment_method, distributor_ids: [shop.id], environment: Rails.env) } let!(:shipping_method) { create(:shipping_method, distributor_ids: [shop.id]) } - let!(:shipment) { create(:shipment_with, :shipping_method, shipping_method: shipping_method) } + let!(:shipment) { create(:shipment_with, :shipping_method, shipping_method:) } let!(:order) { - create(:order, shipments: [shipment], distributor: shop, order_cycle: order_cycle) + create(:order, shipments: [shipment], distributor: shop, order_cycle:) } let(:params) do { order: { @@ -61,7 +61,7 @@ end it "clears shipments and payments before rendering the checkout" do - put update_checkout_path, params: params, as: :json + put update_checkout_path, params:, as: :json # Checking out a BogusGateway without a source fails at :payment # Shipments and payments should then be cleared before rendering checkout @@ -74,12 +74,12 @@ expect(order.adjustment_total).to eq 0 # Add another line item to change the fee totals - create(:line_item, order: order, quantity: 3, price: 5.00) + create(:line_item, order:, quantity: 3, price: 5.00) # Use a check payment method, which should work params[:order][:payments_attributes][0][:payment_method_id] = check_payment_method.id - put update_checkout_path, params: params, as: :json + put update_checkout_path, params:, as: :json expect(response.status).to be 200 order.reload diff --git a/spec/requests/checkout/paypal_spec.rb b/spec/requests/checkout/paypal_spec.rb index 33f4cbf27a6..5fd39d621a0 100644 --- a/spec/requests/checkout/paypal_spec.rb +++ b/spec/requests/checkout/paypal_spec.rb @@ -9,7 +9,7 @@ let!(:address) { create(:address) } let!(:shop) { create(:enterprise) } let!(:shipping_method) { create(:shipping_method_with, :distributor, distributor: shop) } - let!(:shipment) { create(:shipment_with, :shipping_method, shipping_method: shipping_method) } + let!(:shipment) { create(:shipment_with, :shipping_method, shipping_method:) } let!(:order) do create( :order, @@ -19,7 +19,7 @@ bill_address: address.dup ) end - let!(:line_item) { create(:line_item, order: order, quantity: 3, price: 5.00) } + let!(:line_item) { create(:line_item, order:, quantity: 3, price: 5.00) } let!(:payment_method) do Spree::Gateway::PayPalExpress.create!( name: "PayPalExpress", @@ -56,7 +56,7 @@ expect(order.all_adjustments.payment_fee.count).to eq 1 expect(order.all_adjustments.payment_fee.first.amount).to eq 1.5 - get payment_gateways_confirm_paypal_path, params: params + get(payment_gateways_confirm_paypal_path, params:) # Processing was successful, order is complete expect(response).to redirect_to order_path(order, order_token: order.token) diff --git a/spec/requests/checkout/routes_spec.rb b/spec/requests/checkout/routes_spec.rb index d328542ae25..7438420bf2c 100644 --- a/spec/requests/checkout/routes_spec.rb +++ b/spec/requests/checkout/routes_spec.rb @@ -8,10 +8,10 @@ let!(:shop) { create(:enterprise) } let!(:order_cycle) { create(:simple_order_cycle) } let!(:exchange) { - create(:exchange, order_cycle: order_cycle, sender: order_cycle.coordinator, receiver: shop, + create(:exchange, order_cycle:, sender: order_cycle.coordinator, receiver: shop, incoming: false, pickup_time: "Monday") } - let!(:line_item) { create(:line_item, order: order, quantity: 3, price: 5.00) } + let!(:line_item) { create(:line_item, order:, quantity: 3, price: 5.00) } let!(:payment_method) { create(:bogus_payment_method, distributor_ids: [shop.id], environment: Rails.env) } @@ -19,9 +19,9 @@ create(:payment_method, distributor_ids: [shop.id], environment: Rails.env) } let!(:shipping_method) { create(:shipping_method, distributor_ids: [shop.id]) } - let!(:shipment) { create(:shipment_with, :shipping_method, shipping_method: shipping_method) } + let!(:shipment) { create(:shipment_with, :shipping_method, shipping_method:) } let!(:order) { - create(:order, shipments: [shipment], distributor: shop, order_cycle: order_cycle) + create(:order, shipments: [shipment], distributor: shop, order_cycle:) } before do diff --git a/spec/requests/checkout/stripe_sca_spec.rb b/spec/requests/checkout/stripe_sca_spec.rb index 517fec564f5..d6acbc08576 100644 --- a/spec/requests/checkout/stripe_sca_spec.rb +++ b/spec/requests/checkout/stripe_sca_spec.rb @@ -19,7 +19,7 @@ ) end let!(:payment_method) { create(:stripe_sca_payment_method, distributors: [enterprise]) } - let!(:stripe_account) { create(:stripe_account, enterprise: enterprise) } + let!(:stripe_account) { create(:stripe_account, enterprise:) } let!(:line_item) { create(:line_item, price: 12.34) } let!(:order) { line_item.order } let(:address) { create(:address) } @@ -129,7 +129,7 @@ context "and the payment intent request is successful" do it "should process the payment without storing card details" do - put update_checkout_path, params: params + put(update_checkout_path, params:) expect(json_response["path"]).to eq order_path(order, order_token: order.token) expect(order.payments.completed.count).to be 1 @@ -151,7 +151,7 @@ end it "should not process the payment" do - put update_checkout_path, params: params + put(update_checkout_path, params:) expect(response.status).to be 400 @@ -217,7 +217,7 @@ context "and the customer, payment_method and payment_intent requests are successful" do it "should process the payment, and store the card/customer details" do - put update_checkout_path, params: params + put(update_checkout_path, params:) expect(json_response["path"]).to eq order_path(order, order_token: order.token) expect(order.payments.completed.count).to be 1 @@ -239,7 +239,7 @@ end it "should not process the payment" do - put update_checkout_path, params: params + put(update_checkout_path, params:) expect(response.status).to be 400 @@ -256,7 +256,7 @@ end it "should not process the payment" do - put update_checkout_path, params: params + put(update_checkout_path, params:) expect(response.status).to be 400 @@ -271,7 +271,7 @@ end it "should not process the payment" do - put update_checkout_path, params: params + put(update_checkout_path, params:) expect(response.status).to be 400 @@ -303,7 +303,7 @@ context "and the payment intent and payment method requests are accepted" do it "should process the payment, and keep the profile ids and other card details" do - put update_checkout_path, params: params + put(update_checkout_path, params:) expect(json_response["path"]).to eq order_path(order, order_token: order.token) expect(order.payments.completed.count).to be 1 @@ -325,7 +325,7 @@ end it "should not process the payment" do - put update_checkout_path, params: params + put(update_checkout_path, params:) expect(response.status).to be 400 @@ -346,7 +346,7 @@ end it "redirects the user to the authorization stripe url" do - put update_checkout_path, params: params + put(update_checkout_path, params:) expect(response.status).to be 200 expect(response.body).to include stripe_redirect_url diff --git a/spec/requests/voucher_adjustments_spec.rb b/spec/requests/voucher_adjustments_spec.rb index 42ce434f382..39d2e785457 100644 --- a/spec/requests/voucher_adjustments_spec.rb +++ b/spec/requests/voucher_adjustments_spec.rb @@ -12,8 +12,8 @@ create( :order_with_line_items, line_items_count: 1, - distributor: distributor, - order_cycle: order_cycle, + distributor:, + order_cycle:, bill_address: address, ship_address: address ) @@ -34,7 +34,7 @@ let(:params) { { order: { voucher_code: voucher.code } } } it "adds a voucher to the user's current order" do - post "/voucher_adjustments", params: params + post("/voucher_adjustments", params:) expect(response).to be_successful expect(order.reload.voucher_adjustments.length).to eq(1) @@ -44,7 +44,7 @@ let(:params) { { order: { voucher_code: "non_voucher" } } } it "returns 422 and an error message" do - post "/voucher_adjustments", params: params + post("/voucher_adjustments", params:) expect(response).to be_unprocessable expect(flash[:error]).to match "Voucher code Not found" @@ -58,7 +58,7 @@ allow(voucher).to receive(:create_adjustment).and_return(bad_adjustment) allow(Voucher).to receive(:find_by).and_return(voucher) - post "/voucher_adjustments", params: params + post("/voucher_adjustments", params:) expect(response).to be_unprocessable expect(flash[:error]).to match("Voucher code There was an error while adding the voucher") @@ -66,22 +66,22 @@ end context "when the order has a payment and payment feed" do - let(:payment_method) { create(:payment_method, calculator: calculator) } + let(:payment_method) { create(:payment_method, calculator:) } let(:calculator) { Calculator::FlatPercentItemTotal.new(preferred_flat_percent: 10) } before do - create(:payment, order: order, payment_method: payment_method, amount: order.total) + create(:payment, order:, payment_method:, amount: order.total) end it "removes existing payments" do expect do - post "/voucher_adjustments", params: params + post "/voucher_adjustments", params: end.to change { order.reload.payments.count }.from(1).to(0) end it "removes existing payment fees" do expect do - post "/voucher_adjustments", params: params + post "/voucher_adjustments", params: end.to change { order.reload.all_adjustments.payment_fee.count }.from(1).to(0) end end @@ -122,7 +122,7 @@ adjustment_attributes = { amount: 2.00, originator: adjustment.originator, - order: order, + order:, label: "Tax #{adjustment.label}", mandatory: false, state: 'closed', diff --git a/spec/serializers/api/admin/customer_serializer_spec.rb b/spec/serializers/api/admin/customer_serializer_spec.rb index 8fe819ddae4..ff241857af2 100644 --- a/spec/serializers/api/admin/customer_serializer_spec.rb +++ b/spec/serializers/api/admin/customer_serializer_spec.rb @@ -4,7 +4,7 @@ describe Api::Admin::CustomerSerializer do let(:tag_list) { ["one", "two", "three"] } - let(:customer) { create(:customer, tag_list: tag_list) } + let(:customer) { create(:customer, tag_list:) } let!(:tag_rule) { create(:filter_order_cycles_tag_rule, enterprise: customer.enterprise, preferred_customer_tags: "two") @@ -14,7 +14,7 @@ tag_rule_mapping = TagRule.mapping_for(Enterprise.where(id: customer.enterprise_id)) customer_tag_list = { customer.id => tag_list } serializer = Api::Admin::CustomerSerializer.new customer, - tag_rule_mapping: tag_rule_mapping, + tag_rule_mapping:, customer_tags: customer_tag_list result = JSON.parse(serializer.to_json) expect(result['email']).to eq customer.email diff --git a/spec/serializers/api/admin/for_order_cycle/supplied_product_serializer_spec.rb b/spec/serializers/api/admin/for_order_cycle/supplied_product_serializer_spec.rb index 6b8002067c0..f37eb83f09a 100644 --- a/spec/serializers/api/admin/for_order_cycle/supplied_product_serializer_spec.rb +++ b/spec/serializers/api/admin/for_order_cycle/supplied_product_serializer_spec.rb @@ -4,13 +4,13 @@ describe Api::Admin::ForOrderCycle::SuppliedProductSerializer do let(:coordinator) { create(:distributor_enterprise) } - let(:order_cycle) { double(:order_cycle, coordinator: coordinator) } + let(:order_cycle) { double(:order_cycle, coordinator:) } let!(:product) { create(:simple_product) } let!(:non_inventory_variant) { product.variants.first } let!(:inventory_variant) { create(:variant, product: product.reload) } let(:serialized_product) { Api::Admin::ForOrderCycle::SuppliedProductSerializer.new(product, - order_cycle: order_cycle ).to_json + order_cycle: ).to_json } let!(:inventory_item) { create(:inventory_item, enterprise: coordinator, variant: inventory_variant, visible: true) diff --git a/spec/serializers/api/admin/index_enterprise_serializer_spec.rb b/spec/serializers/api/admin/index_enterprise_serializer_spec.rb index d041b2648e4..e16a66a235b 100644 --- a/spec/serializers/api/admin/index_enterprise_serializer_spec.rb +++ b/spec/serializers/api/admin/index_enterprise_serializer_spec.rb @@ -7,7 +7,7 @@ context "when spree_current_user is a manager" do let(:user) { create(:user) } before do - user.enterprise_roles.create(enterprise: enterprise) + user.enterprise_roles.create(enterprise:) end it "sets 'owned' to false" do diff --git a/spec/serializers/api/admin/order_serializer_spec.rb b/spec/serializers/api/admin/order_serializer_spec.rb index ef19145045b..f1f16665c53 100644 --- a/spec/serializers/api/admin/order_serializer_spec.rb +++ b/spec/serializers/api/admin/order_serializer_spec.rb @@ -41,7 +41,7 @@ let!(:payment) do create( :payment, - order: order, + order:, state: 'requires_authorization', amount: 123.45, cvv_response_message: "https://stripe.com/redirect" @@ -57,7 +57,7 @@ let!(:pending_payment) do create( :payment, - order: order, + order:, state: 'pending', amount: 123.45, ) diff --git a/spec/serializers/api/admin/variant_override_serializer_spec.rb b/spec/serializers/api/admin/variant_override_serializer_spec.rb index aac75e138bd..e282ea0175f 100644 --- a/spec/serializers/api/admin/variant_override_serializer_spec.rb +++ b/spec/serializers/api/admin/variant_override_serializer_spec.rb @@ -6,8 +6,8 @@ let(:price) { 77.77 } let(:count_on_hand) { 11_111 } let(:variant_override) { - create(:variant_override, variant: variant, hub: hub, price: price, - count_on_hand: count_on_hand) + create(:variant_override, variant:, hub:, price:, + count_on_hand:) } it "serializes a variant override" do diff --git a/spec/serializers/api/enterprise_serializer_spec.rb b/spec/serializers/api/enterprise_serializer_spec.rb index c0bfa722375..970c8f63d32 100644 --- a/spec/serializers/api/enterprise_serializer_spec.rb +++ b/spec/serializers/api/enterprise_serializer_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' describe Api::EnterpriseSerializer do - let(:serializer) { Api::EnterpriseSerializer.new enterprise, data: data } + let(:serializer) { Api::EnterpriseSerializer.new enterprise, data: } let(:enterprise) { create(:distributor_enterprise, is_primary_producer: true) } let(:taxon) { create(:taxon) } let(:data) {