Result of rubocop -a, safe autocorrect

This commit is contained in:
Luis Ramos
2021-07-13 22:38:05 +01:00
parent a7944af73d
commit 01fe6abeed
4 changed files with 72 additions and 21 deletions

View File

@@ -57,7 +57,8 @@ module Spree
state_machine initial: :checkout do
# With card payments, happens before purchase or authorization happens
event :started_processing do
transition from: [:checkout, :pending, :completed, :processing, :requires_authorization], to: :processing
transition from: [:checkout, :pending, :completed, :processing, :requires_authorization],
to: :processing
end
# When processing during checkout fails
event :failure do

View File

@@ -226,7 +226,9 @@ module OrderManagement
order.total = 30
allow(order).to receive_message_chain(:payments, :valid, :empty?) { false }
allow(order).to receive_message_chain(:payments, :completed, :empty?) { false }
allow(order).to receive_message_chain(:payments, :requires_authorization, :any?) { false }
allow(order).to receive_message_chain(:payments, :requires_authorization, :any?) {
false
}
expect {
updater.update_payment_state

View File

@@ -21,8 +21,14 @@ feature '
end
context "displaying the list of line items" do
let!(:o1) { create(:order_with_distributor, state: 'complete', shipment_state: 'ready', completed_at: Time.zone.now ) }
let!(:o2) { create(:order_with_distributor, state: 'complete', shipment_state: 'ready', completed_at: Time.zone.now ) }
let!(:o1) {
create(:order_with_distributor, state: 'complete', shipment_state: 'ready',
completed_at: Time.zone.now )
}
let!(:o2) {
create(:order_with_distributor, state: 'complete', shipment_state: 'ready',
completed_at: Time.zone.now )
}
let!(:o3) { create(:order_with_distributor, state: 'address', completed_at: nil ) }
let!(:o4) { create(:order_with_distributor, state: 'complete', completed_at: Time.zone.now ) }
let!(:o5) { create(:order_with_distributor, state: 'complete', completed_at: Time.zone.now ) }
@@ -110,8 +116,14 @@ feature '
end
describe "sorting of line items" do
let!(:o1) { create(:order_with_distributor, state: 'complete', shipment_state: 'ready', completed_at: Time.zone.now) }
let!(:o2) { create(:order_with_distributor, state: 'complete', shipment_state: 'ready', completed_at: Time.zone.now) }
let!(:o1) {
create(:order_with_distributor, state: 'complete', shipment_state: 'ready',
completed_at: Time.zone.now)
}
let!(:o2) {
create(:order_with_distributor, state: 'complete', shipment_state: 'ready',
completed_at: Time.zone.now)
}
let!(:li1) { create(:line_item_with_shipment, order: o1) }
let!(:li2) { create(:line_item_with_shipment, order: o2) }
@@ -154,7 +166,10 @@ feature '
end
context "tracking changes" do
let!(:o1) { create(:order_with_distributor, state: 'complete', shipment_state: 'ready', completed_at: Time.zone.now ) }
let!(:o1) {
create(:order_with_distributor, state: 'complete', shipment_state: 'ready',
completed_at: Time.zone.now )
}
let!(:li1) { create(:line_item_with_shipment, order: o1, quantity: 5 ) }
before :each do
@@ -214,7 +229,10 @@ feature '
variant_unit: "weight", variants: [create(:variant, unit_value: 1000)] )
}
let!(:v1) { p1.variants.first }
let!(:o1) { create(:order_with_distributor, state: 'complete', shipment_state: 'ready', completed_at: Time.zone.now ) }
let!(:o1) {
create(:order_with_distributor, state: 'complete', shipment_state: 'ready',
completed_at: Time.zone.now )
}
let!(:li1) {
create(:line_item_with_shipment, order: o1, variant: v1, quantity: 5, final_weight_volume: 1000,
price: 10.00 )
@@ -480,9 +498,18 @@ feature '
end
context "using quick search" do
let!(:o1) { create(:order_with_distributor, state: 'complete', shipment_state: 'ready', completed_at: Time.zone.now ) }
let!(:o2) { create(:order_with_distributor, state: 'complete', shipment_state: 'ready', completed_at: Time.zone.now ) }
let!(:o3) { create(:order_with_distributor, state: 'complete', shipment_state: 'ready', completed_at: Time.zone.now ) }
let!(:o1) {
create(:order_with_distributor, state: 'complete', shipment_state: 'ready',
completed_at: Time.zone.now )
}
let!(:o2) {
create(:order_with_distributor, state: 'complete', shipment_state: 'ready',
completed_at: Time.zone.now )
}
let!(:o3) {
create(:order_with_distributor, state: 'complete', shipment_state: 'ready',
completed_at: Time.zone.now )
}
let!(:li1) { create(:line_item_with_shipment, order: o1 ) }
let!(:li2) { create(:line_item_with_shipment, order: o2 ) }
let!(:li3) { create(:line_item_with_shipment, order: o3 ) }
@@ -508,10 +535,12 @@ feature '
completed_at: Time.zone.today - 7.days - 1.second)
}
let!(:o2) {
create(:order_with_distributor, state: 'complete', shipment_state: 'ready', completed_at: Time.zone.today - 7.days)
create(:order_with_distributor, state: 'complete', shipment_state: 'ready',
completed_at: Time.zone.today - 7.days)
}
let!(:o3) {
create(:order_with_distributor, state: 'complete', shipment_state: 'ready', completed_at: Time.zone.now.end_of_day)
create(:order_with_distributor, state: 'complete', shipment_state: 'ready',
completed_at: Time.zone.now.end_of_day)
}
let!(:o4) {
create(:order_with_distributor, state: 'complete', shipment_state: 'ready',
@@ -593,8 +622,14 @@ feature '
end
context "bulk action controls" do
let!(:o1) { create(:order_with_distributor, state: 'complete', shipment_state: 'ready', completed_at: Time.zone.now ) }
let!(:o2) { create(:order_with_distributor, state: 'complete', shipment_state: 'ready', completed_at: Time.zone.now ) }
let!(:o1) {
create(:order_with_distributor, state: 'complete', shipment_state: 'ready',
completed_at: Time.zone.now )
}
let!(:o2) {
create(:order_with_distributor, state: 'complete', shipment_state: 'ready',
completed_at: Time.zone.now )
}
let!(:li1) { create(:line_item_with_shipment, order: o1 ) }
let!(:li2) { create(:line_item_with_shipment, order: o2 ) }
@@ -716,10 +751,12 @@ feature '
context "using delete buttons" do
let!(:o1) {
create(:order_with_distributor, state: 'complete', shipment_state: 'ready', completed_at: Time.zone.now )
create(:order_with_distributor, state: 'complete', shipment_state: 'ready',
completed_at: Time.zone.now )
}
let!(:o2) {
create(:order_with_distributor, state: 'complete', shipment_state: 'ready', completed_at: Time.zone.now )
create(:order_with_distributor, state: 'complete', shipment_state: 'ready',
completed_at: Time.zone.now )
}
let!(:li1) { create(:line_item_with_shipment, order: o1 ) }
let!(:li2) { create(:line_item_with_shipment, order: o2 ) }
@@ -742,8 +779,14 @@ feature '
end
context "clicking the link on variant name" do
let!(:o1) { create(:order_with_distributor, state: 'complete', shipment_state: 'ready', completed_at: Time.zone.now ) }
let!(:o2) { create(:order_with_distributor, state: 'complete', shipment_state: 'ready', completed_at: Time.zone.now ) }
let!(:o1) {
create(:order_with_distributor, state: 'complete', shipment_state: 'ready',
completed_at: Time.zone.now )
}
let!(:o2) {
create(:order_with_distributor, state: 'complete', shipment_state: 'ready',
completed_at: Time.zone.now )
}
let!(:li1) { create(:line_item_with_shipment, order: o1 ) }
let!(:li2) { create(:line_item_with_shipment, order: o2 ) }
let!(:p3) {
@@ -751,7 +794,10 @@ feature '
variant_unit: "weight", variants: [create(:variant, unit_value: 1000)] )
}
let!(:v3) { p3.variants.first }
let!(:o3) { create(:order_with_distributor, state: 'complete', shipment_state: 'ready', completed_at: Time.zone.now ) }
let!(:o3) {
create(:order_with_distributor, state: 'complete', shipment_state: 'ready',
completed_at: Time.zone.now )
}
let!(:li3) {
create(:line_item_with_shipment, order: o3, variant: v3, quantity: 3, max_quantity: 6 )
}

View File

@@ -43,7 +43,9 @@ describe PlaceProxyOrder do
end
context "when the order is already complete" do
let(:summarizer) { instance_double(OrderManagement::Subscriptions::Summarizer, record_order: true) }
let(:summarizer) {
instance_double(OrderManagement::Subscriptions::Summarizer, record_order: true)
}
let!(:proxy_order) { create(:proxy_order, subscription: subscription) }
let(:order) { proxy_order.order }