Fix more rubocop issues with auto correct

This commit is contained in:
Luis Ramos
2020-10-30 17:07:43 +00:00
parent c71ebc38bb
commit c2c12b34f9
5 changed files with 10 additions and 11 deletions

View File

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

View File

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

View File

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

View File

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

View File

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