From c2c12b34f9277bb9c14d94f710aafacee4551a3b Mon Sep 17 00:00:00 2001 From: Luis Ramos Date: Fri, 30 Oct 2020 17:07:43 +0000 Subject: [PATCH] Fix more rubocop issues with auto correct --- spec/lib/stripe/credit_card_cloner_spec.rb | 4 ++-- .../product_import/inventory_reset_strategy_spec.rb | 1 - spec/models/spree/order/payment_spec.rb | 2 +- spec/models/spree/order_inventory_spec.rb | 12 ++++++------ spec/models/spree/order_spec.rb | 2 +- 5 files changed, 10 insertions(+), 11 deletions(-) diff --git a/spec/lib/stripe/credit_card_cloner_spec.rb b/spec/lib/stripe/credit_card_cloner_spec.rb index 432d707676..5b05aa99d7 100644 --- a/spec/lib/stripe/credit_card_cloner_spec.rb +++ b/spec/lib/stripe/credit_card_cloner_spec.rb @@ -27,8 +27,8 @@ module Stripe allow(Stripe).to receive(:api_key) { "sk_test_12345" } stub_customers_post_request email: credit_card.user.email, - response: { customer_id: new_customer_id }, - stripe_account_header: true + response: { customer_id: new_customer_id }, + stripe_account_header: true stub_request(:post, "https://api.stripe.com/v1/payment_methods/#{new_payment_method_id}/attach") .with(body: { customer: new_customer_id }, diff --git a/spec/models/product_import/inventory_reset_strategy_spec.rb b/spec/models/product_import/inventory_reset_strategy_spec.rb index 1e9ab2ca86..319941de23 100644 --- a/spec/models/product_import/inventory_reset_strategy_spec.rb +++ b/spec/models/product_import/inventory_reset_strategy_spec.rb @@ -4,7 +4,6 @@ describe ProductImport::InventoryResetStrategy do let(:inventory_reset) { described_class.new(excluded_items_ids) } describe '#reset' do - context 'when there are excluded_items_ids' do let(:enterprise) { variant.product.supplier } let(:variant) { build_stubbed(:variant) } diff --git a/spec/models/spree/order/payment_spec.rb b/spec/models/spree/order/payment_spec.rb index 94087fa799..44e434bd5e 100644 --- a/spec/models/spree/order/payment_spec.rb +++ b/spec/models/spree/order/payment_spec.rb @@ -6,7 +6,7 @@ module Spree describe Spree::Order do let(:order) { build(:order) } let(:updater) { OrderManagement::Order::Updater.new(order) } - let(:bogus) { create(:bogus_payment_method, distributors: [create(:enterprise)]) } + let(:bogus) { create(:bogus_payment_method, distributors: [create(:enterprise)]) } before do # So that Payment#purchase! is called during processing diff --git a/spec/models/spree/order_inventory_spec.rb b/spec/models/spree/order_inventory_spec.rb index 57df61ef14..e4f84565bf 100644 --- a/spec/models/spree/order_inventory_spec.rb +++ b/spec/models/spree/order_inventory_spec.rb @@ -46,8 +46,8 @@ describe Spree::OrderInventory do expect(subject.send(:add_to_shipment, shipment, variant, 5)).to eq 5 - units = shipment.inventory_units.group_by &:variant_id - units = units[variant.id].group_by &:state + units = shipment.inventory_units.group_by(&:variant_id) + units = units[variant.id].group_by(&:state) expect(units['backordered'].size).to eq 2 expect(units['on_hand'].size).to eq 3 end @@ -103,8 +103,8 @@ describe Spree::OrderInventory do it 'should destroy backordered units first' do allow(shipment).to receive_messages(inventory_units_for: [build(:inventory_unit, variant_id: variant.id, state: 'backordered'), - build(:inventory_unit, variant_id: variant.id, state: 'on_hand'), - build(:inventory_unit, variant_id: variant.id, state: 'backordered')]) + build(:inventory_unit, variant_id: variant.id, state: 'on_hand'), + build(:inventory_unit, variant_id: variant.id, state: 'backordered')]) expect(shipment.inventory_units_for[0]).to receive(:destroy) expect(shipment.inventory_units_for[1]).not_to receive(:destroy) @@ -115,7 +115,7 @@ describe Spree::OrderInventory do it 'should destroy unshipped units first' do allow(shipment).to receive_messages(inventory_units_for: [build(:inventory_unit, variant_id: variant.id, state: 'shipped'), - build(:inventory_unit, variant_id: variant.id, state: 'on_hand')] ) + build(:inventory_unit, variant_id: variant.id, state: 'on_hand')] ) expect(shipment.inventory_units_for[0]).not_to receive(:destroy) expect(shipment.inventory_units_for[1]).to receive(:destroy) @@ -125,7 +125,7 @@ describe Spree::OrderInventory do it 'only attempts to destroy as many units as are eligible, and return amount destroyed' do allow(shipment).to receive_messages(inventory_units_for: [build(:inventory_unit, variant_id: variant.id, state: 'shipped'), - build(:inventory_unit, variant_id: variant.id, state: 'on_hand')] ) + build(:inventory_unit, variant_id: variant.id, state: 'on_hand')] ) expect(shipment.inventory_units_for[0]).not_to receive(:destroy) expect(shipment.inventory_units_for[1]).to receive(:destroy) diff --git a/spec/models/spree/order_spec.rb b/spec/models/spree/order_spec.rb index 3bc8d72e8b..410fc588ed 100644 --- a/spec/models/spree/order_spec.rb +++ b/spec/models/spree/order_spec.rb @@ -27,7 +27,7 @@ describe Spree::Order do context "#generate_order_number" do it "should generate a random string" do expect(order.generate_order_number.is_a?(String)).to be_truthy - expect((!order.generate_order_number.to_s.empty?)).to be_truthy + expect(!order.generate_order_number.to_s.empty?).to be_truthy end end