From dce02160d4f9464887664cdaf4332fcc5e7ec3f5 Mon Sep 17 00:00:00 2001 From: Neal Chambers Date: Fri, 21 Jul 2023 22:41:57 +0900 Subject: [PATCH 1/7] Safely autocorrect Layout/HashAlignment Inspecting 1478 files ...................................................................................................................................................C.......................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................C......................................................................................................................................................................................................................................................C......................CC....................C...................................................... Offenses: app/controllers/spree/users_controller.rb:53:19: C: [Corrected] Layout/HashAlignment: Align the keys of a hash literal if they span more than one line. message: t('devise.user_registrations.spree_user.signed_up_but_unconfirmed') }) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ app/controllers/spree/users_controller.rb:53:101: C: Layout/LineLength: Line is too long. [107/100] message: t('devise.user_registrations.spree_user.signed_up_but_unconfirmed') }) ^^^^^^^ spec/models/enterprise_spec.rb:906:1: C: [Corrected] Layout/HashAlignment: Align the keys of a hash literal if they span more than one line. permissions: [permission]) ^^^^^^^^^^^^^^^^^^^^^^^^^ spec/system/admin/customers_spec.rb:19:1: C: [Corrected] Layout/HashAlignment: Align the keys of a hash literal if they span more than one line. code: nil, created_manually: true) ^^^^^^^^^ spec/system/admin/order_spec.rb:708:1: C: [Corrected] Layout/HashAlignment: Align the keys of a hash literal if they span more than one line. distributors: [distributor1]) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ spec/system/admin/orders_spec.rb:45:4: C: [Corrected] Layout/HashAlignment: Align the keys of a hash literal if they span more than one line. distributors: [distributor4, distributor5]) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ spec/system/admin/orders_spec.rb:249:9: C: [Corrected] Layout/HashAlignment: Align the keys of a hash literal if they span more than one line. line_items_count: 0) ^^^^^^^^^^^^^^^^^^^ spec/system/admin/orders_spec.rb:254:9: C: [Corrected] Layout/HashAlignment: Align the keys of a hash literal if they span more than one line. line_items_count: 1) ^^^^^^^^^^^^^^^^^^^ spec/system/admin/orders_spec.rb:259:9: C: [Corrected] Layout/HashAlignment: Align the keys of a hash literal if they span more than one line. distributor: distributor2, bill_address_id: nil, ship_address_id: nil) ^^^^^^^^^^^^^^^^^^^^^^^^^ spec/system/admin/orders_spec.rb:259:101: C: Layout/LineLength: Line is too long. [109/100] distributor: distributor2, bill_address_id: nil, ship_address_id: nil) ^^^^^^^^^ spec/system/admin/tag_rules_spec.rb:145:37: C: [Corrected] Layout/HashAlignment: Align the keys of a hash literal if they span more than one line. count: 4 ^^^^^^^^ 1478 files inspected, 11 offenses detected, 9 offenses corrected --- .rubocop_todo.yml | 15 --------------- app/controllers/spree/users_controller.rb | 2 +- spec/models/enterprise_spec.rb | 2 +- spec/system/admin/customers_spec.rb | 2 +- spec/system/admin/order_spec.rb | 2 +- spec/system/admin/orders_spec.rb | 8 ++++---- spec/system/admin/tag_rules_spec.rb | 2 +- 7 files changed, 9 insertions(+), 24 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index bd7e8d2bdd..2b63b15cb8 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -6,21 +6,6 @@ # Note that changes in the inspected code, or installation of new # versions of RuboCop, may require this file to be generated again. -# Offense count: 9 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: AllowMultipleStyles, EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle. -# SupportedHashRocketStyles: key, separator, table -# SupportedColonStyles: key, separator, table -# SupportedLastArgumentHashStyles: always_inspect, always_ignore, ignore_implicit, ignore_explicit -Layout/HashAlignment: - Exclude: - - 'app/controllers/spree/users_controller.rb' - - 'spec/models/enterprise_spec.rb' - - 'spec/system/admin/customers_spec.rb' - - 'spec/system/admin/order_spec.rb' - - 'spec/system/admin/orders_spec.rb' - - 'spec/system/admin/tag_rules_spec.rb' - # Offense count: 4 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: EnforcedStyle. diff --git a/app/controllers/spree/users_controller.rb b/app/controllers/spree/users_controller.rb index cba00ac922..4637dc5b12 100644 --- a/app/controllers/spree/users_controller.rb +++ b/app/controllers/spree/users_controller.rb @@ -50,7 +50,7 @@ module Spree "#signup-feedback", partial("layouts/alert", locals: { type: "success", - message: t('devise.user_registrations.spree_user.signed_up_but_unconfirmed') }) + message: t('devise.user_registrations.spree_user.signed_up_but_unconfirmed') }) ) else render status: :unprocessable_entity, cable_ready: cable_car.morph( diff --git a/spec/models/enterprise_spec.rb b/spec/models/enterprise_spec.rb index fbe15221d5..a53c1b5ff9 100644 --- a/spec/models/enterprise_spec.rb +++ b/spec/models/enterprise_spec.rb @@ -903,7 +903,7 @@ describe Enterprise do distributor = create(:distributor_enterprise, is_primary_producer: false) permission = EnterpriseRelationshipPermission.create(name: "add_to_order_cycle") create(:enterprise_relationship, parent: distributor, child: supplier, -permissions: [permission]) + permissions: [permission]) product = create(:product) order_cycle = create( :simple_order_cycle, diff --git a/spec/system/admin/customers_spec.rb b/spec/system/admin/customers_spec.rb index acdd9497c3..94599e3e57 100644 --- a/spec/system/admin/customers_spec.rb +++ b/spec/system/admin/customers_spec.rb @@ -16,7 +16,7 @@ describe 'Customers' do describe "using the customers index" do let!(:customer1) { create(:customer, first_name: 'John', last_name: 'Doe', enterprise: managed_distributor1, -code: nil, created_manually: true) + code: nil, created_manually: true) } let!(:customer2) { create(:customer, enterprise: managed_distributor1, created_manually: true, code: nil) diff --git a/spec/system/admin/order_spec.rb b/spec/system/admin/order_spec.rb index c64b13e1bb..6c0cb60835 100644 --- a/spec/system/admin/order_spec.rb +++ b/spec/system/admin/order_spec.rb @@ -705,7 +705,7 @@ describe ' context "with different shipping methods" do let!(:different_shipping_method_for_distributor1) do create(:shipping_method_with, :flat_rate, name: "Different", amount: 15, -distributors: [distributor1]) + distributors: [distributor1]) end let!(:shipping_method_for_distributor2) do create(:shipping_method, name: "Other", distributors: [distributor2]) diff --git a/spec/system/admin/orders_spec.rb b/spec/system/admin/orders_spec.rb index cf6f31cd29..f6a0883953 100644 --- a/spec/system/admin/orders_spec.rb +++ b/spec/system/admin/orders_spec.rb @@ -42,7 +42,7 @@ describe ' } let!(:shipping_method2) { create(:shipping_method_with, :pickup, name: "delivery", - distributors: [distributor4, distributor5]) + distributors: [distributor4, distributor5]) } let(:order_cycle) do create(:simple_order_cycle, name: 'One', distributors: [distributor, distributor2, @@ -246,17 +246,17 @@ describe ' context "cart orders" do let!(:order_empty) { create(:order_with_line_items, user: customer2, distributor: distributor2, - line_items_count: 0) + line_items_count: 0) } let!(:order_not_empty) { create(:order_with_line_items, user: customer2, distributor: distributor2, - line_items_count: 1) + line_items_count: 1) } let!(:order_not_empty_no_address) { create(:order_with_line_items, line_items_count: 1, user: customer2, - distributor: distributor2, bill_address_id: nil, ship_address_id: nil) + distributor: distributor2, bill_address_id: nil, ship_address_id: nil) } before do diff --git a/spec/system/admin/tag_rules_spec.rb b/spec/system/admin/tag_rules_spec.rb index 788911f41e..01ad0741ee 100644 --- a/spec/system/admin/tag_rules_spec.rb +++ b/spec/system/admin/tag_rules_spec.rb @@ -142,7 +142,7 @@ describe 'Tag Rules' do it "saves changes to rules of each type" do # Tag groups exist expect(page).to have_selector '.customer_tag .header', text: "For customers tagged:", - count: 4 + count: 4 expect(page).to have_selector '.customer_tag .header tags-input .tag-list ti-tag-item', text: "member", count: 1 expect(page).to have_selector '.customer_tag .header tags-input .tag-list ti-tag-item', From 9155614501741aa7a9588258a53fd48a3f3a2c4a Mon Sep 17 00:00:00 2001 From: Neal Chambers Date: Fri, 21 Jul 2023 22:43:15 +0900 Subject: [PATCH 2/7] Safely autocorrect Layout/IndentationConsistency Inspecting 1478 files .....................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................C.C.......C...................................................................... Offenses: spec/system/admin/order_cycles/complex_updating_specific_time_spec.rb:84:7: C: [Corrected] Layout/IndentationConsistency: Inconsistent indentation detected. "#order_cycle_incoming_exchange_1_variants_#{initial_variants.last.id}" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ spec/system/admin/order_cycles/simple_spec.rb:784:9: C: [Corrected] Layout/IndentationConsistency: Inconsistent indentation detected. "order_cycle_selected_distributor_payment_method_ids_#{distributor_payment_method_id}" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ spec/system/admin/order_cycles/simple_spec.rb:791:9: C: [Corrected] Layout/IndentationConsistency: Inconsistent indentation detected. "order_cycle_selected_distributor_shipping_method_ids_#{distributor_shipping_method_id}" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ spec/system/admin/product_import_spec.rb:818:15: C: [Corrected] Layout/IndentationConsistency: Inconsistent indentation detected. I18n.t("admin.product_import.product_headings.#{heading}").upcase ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 1478 files inspected, 4 offenses detected, 4 offenses corrected --- .rubocop_todo.yml | 14 +++----------- .../complex_updating_specific_time_spec.rb | 2 +- spec/system/admin/order_cycles/simple_spec.rb | 4 ++-- spec/system/admin/product_import_spec.rb | 2 +- 4 files changed, 7 insertions(+), 15 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 2b63b15cb8..ec19737c81 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -6,16 +6,6 @@ # Note that changes in the inspected code, or installation of new # versions of RuboCop, may require this file to be generated again. -# Offense count: 4 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: EnforcedStyle. -# SupportedStyles: normal, indented_internal_methods -Layout/IndentationConsistency: - Exclude: - - 'spec/system/admin/order_cycles/complex_updating_specific_time_spec.rb' - - 'spec/system/admin/order_cycles/simple_spec.rb' - - 'spec/system/admin/product_import_spec.rb' - # Offense count: 1 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: AllowDoxygenCommentStyle, AllowGemfileRubyComment. @@ -32,7 +22,7 @@ Layout/LineContinuationSpacing: - 'spec/system/admin/enterprise_fees_spec.rb' - 'spec/system/admin/order_spec.rb' -# Offense count: 92 +# Offense count: 94 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: Max, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns. # URISchemes: http, https @@ -40,6 +30,7 @@ Layout/LineLength: Exclude: - 'app/components/confirm_modal_component.rb' - 'app/controllers/admin/product_import_controller.rb' + - 'app/controllers/spree/users_controller.rb' - 'app/models/customer.rb' - 'app/models/spree/line_item.rb' - 'spec/controllers/admin/order_cycles_controller_spec.rb' @@ -63,6 +54,7 @@ Layout/LineLength: - 'spec/system/admin/customers_spec.rb' - 'spec/system/admin/order_cycles/simple_spec.rb' - 'spec/system/admin/order_spec.rb' + - 'spec/system/admin/orders_spec.rb' - 'spec/system/admin/product_import_spec.rb' - 'spec/system/consumer/shopping/cart_spec.rb' - 'spec/system/consumer/shopping/products_spec.rb' diff --git a/spec/system/admin/order_cycles/complex_updating_specific_time_spec.rb b/spec/system/admin/order_cycles/complex_updating_specific_time_spec.rb index c550794cb1..df32676f34 100644 --- a/spec/system/admin/order_cycles/complex_updating_specific_time_spec.rb +++ b/spec/system/admin/order_cycles/complex_updating_specific_time_spec.rb @@ -81,7 +81,7 @@ xdescribe ' open_all_exchange_product_tabs expect(page).to have_selector - "#order_cycle_incoming_exchange_1_variants_#{initial_variants.last.id}" + "#order_cycle_incoming_exchange_1_variants_#{initial_variants.last.id}" # uncheck (with visible:true filter) page.find("#order_cycle_incoming_exchange_1_variants_#{initial_variants.last.id}").click check "order_cycle_incoming_exchange_2_variants_#{v1.id}" diff --git a/spec/system/admin/order_cycles/simple_spec.rb b/spec/system/admin/order_cycles/simple_spec.rb index ec993e9d91..46759c34c2 100644 --- a/spec/system/admin/order_cycles/simple_spec.rb +++ b/spec/system/admin/order_cycles/simple_spec.rb @@ -781,14 +781,14 @@ describe ' def expect_payment_methods_to_be_checked_for(distributor) distributor.distributor_payment_method_ids.each do |distributor_payment_method_id| expect(page).to have_checked_field - "order_cycle_selected_distributor_payment_method_ids_#{distributor_payment_method_id}" + "order_cycle_selected_distributor_payment_method_ids_#{distributor_payment_method_id}" end end def expect_shipping_methods_to_be_checked_for(distributor) distributor.distributor_shipping_method_ids.each do |distributor_shipping_method_id| expect(page).to have_checked_field - "order_cycle_selected_distributor_shipping_method_ids_#{distributor_shipping_method_id}" + "order_cycle_selected_distributor_shipping_method_ids_#{distributor_shipping_method_id}" end end diff --git a/spec/system/admin/product_import_spec.rb b/spec/system/admin/product_import_spec.rb index f0e423fd87..2692cacc06 100644 --- a/spec/system/admin/product_import_spec.rb +++ b/spec/system/admin/product_import_spec.rb @@ -815,7 +815,7 @@ describe "Product Import" do product_headings.each do |heading| expect(page).to have_content - I18n.t("admin.product_import.product_headings.#{heading}").upcase + I18n.t("admin.product_import.product_headings.#{heading}").upcase end end end From 948b287fd6bf1a7bd8289fbb47391c882163d8fe Mon Sep 17 00:00:00 2001 From: Neal Chambers Date: Fri, 21 Jul 2023 22:44:34 +0900 Subject: [PATCH 3/7] Safely autocorrect Layout/LeadingCommentSpace Inspecting 1478 files ............................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................C......................................................................................... Offenses: spec/system/admin/enterprises_spec.rb:204:5: C: [Corrected] Layout/LeadingCommentSpace: Missing space after #. #using "find" as fields outside of the screen and are not visible ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 1478 files inspected, 1 offense detected, 1 offense corrected --- .rubocop_todo.yml | 7 ------- spec/system/admin/enterprises_spec.rb | 2 +- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index ec19737c81..d6bae6504a 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -6,13 +6,6 @@ # Note that changes in the inspected code, or installation of new # versions of RuboCop, may require this file to be generated again. -# Offense count: 1 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: AllowDoxygenCommentStyle, AllowGemfileRubyComment. -Layout/LeadingCommentSpace: - Exclude: - - 'spec/system/admin/enterprises_spec.rb' - # Offense count: 4 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: EnforcedStyle. diff --git a/spec/system/admin/enterprises_spec.rb b/spec/system/admin/enterprises_spec.rb index f88a200f29..4ea82073e3 100644 --- a/spec/system/admin/enterprises_spec.rb +++ b/spec/system/admin/enterprises_spec.rb @@ -201,7 +201,7 @@ describe ' shop_message_input.native.send_keys('This is my shopfront message.') expect(page) .to have_checked_field "enterprise_preferred_shopfront_order_cycle_order_orders_close_at" - #using "find" as fields outside of the screen and are not visible + # using "find" as fields outside of the screen and are not visible find(:xpath, '//*[@id="enterprise_preferred_shopfront_order_cycle_order_orders_open_at"]') .trigger("click") find(:xpath, '//*[@id="enterprise_enable_subscriptions_true"]').trigger("click") From e546a6b583eb7e4e86f8b9ac76d1e661b7ff6ee0 Mon Sep 17 00:00:00 2001 From: Neal Chambers Date: Fri, 21 Jul 2023 22:45:51 +0900 Subject: [PATCH 4/7] Safely autocorrect Layout/LineContinuationSpacing Inspecting 1478 files ...................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................C.....................C............................................................................ Offenses: spec/system/admin/enterprise_fees_spec.rb:52:46: C: [Corrected] Layout/LineContinuationSpacing: Use one space in front of backslash. fill_in "#{prefix}_calculator_attributes"\ ^ spec/system/admin/enterprise_fees_spec.rb:57:58: C: [Corrected] Layout/LineContinuationSpacing: Use one space in front of backslash. expect(page).to have_selector("##{prefix}_calculator"\ ^ spec/system/admin/enterprise_fees_spec.rb:142:43: C: [Corrected] Layout/LineContinuationSpacing: Use one space in front of backslash. "#{prefix}_calculator_attributes_"\ ^ spec/system/admin/order_spec.rb:646:84: C: [Corrected] Layout/LineContinuationSpacing: Use one space in front of backslash. accept_alert "An invoice for this order will be sent to the customer. "\ ^ 1478 files inspected, 4 offenses detected, 4 offenses corrected --- .rubocop_todo.yml | 9 --------- spec/system/admin/enterprise_fees_spec.rb | 6 +++--- spec/system/admin/order_spec.rb | 2 +- 3 files changed, 4 insertions(+), 13 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index d6bae6504a..0f7e5b5daa 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -6,15 +6,6 @@ # Note that changes in the inspected code, or installation of new # versions of RuboCop, may require this file to be generated again. -# Offense count: 4 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: EnforcedStyle. -# SupportedStyles: space, no_space -Layout/LineContinuationSpacing: - Exclude: - - 'spec/system/admin/enterprise_fees_spec.rb' - - 'spec/system/admin/order_spec.rb' - # Offense count: 94 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: Max, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns. diff --git a/spec/system/admin/enterprise_fees_spec.rb b/spec/system/admin/enterprise_fees_spec.rb index 0669db1418..9ff0ae0da9 100644 --- a/spec/system/admin/enterprise_fees_spec.rb +++ b/spec/system/admin/enterprise_fees_spec.rb @@ -49,12 +49,12 @@ describe ' expect(page).to have_selector "input[value='Hello!']" # When I fill in the calculator fields and click update - fill_in "#{prefix}_calculator_attributes"\ + fill_in "#{prefix}_calculator_attributes" \ "_preferred_flat_percent", with: '12.34' click_button 'Update' # Then I should see the correct values in my calculator fields - expect(page).to have_selector("##{prefix}_calculator"\ + expect(page).to have_selector("##{prefix}_calculator" \ "_attributes_preferred_flat_percent[value='12.34']") end @@ -139,7 +139,7 @@ describe ' it 'shows error flash when updating fee amount with invalid values' do # When I fill in the calculator fields and click update fill_in( - "#{prefix}_calculator_attributes_"\ + "#{prefix}_calculator_attributes_" \ 'preferred_flat_percent', with: "\'20.0'" ) click_button 'Update' diff --git a/spec/system/admin/order_spec.rb b/spec/system/admin/order_spec.rb index 6c0cb60835..4007224466 100644 --- a/spec/system/admin/order_spec.rb +++ b/spec/system/admin/order_spec.rb @@ -643,7 +643,7 @@ describe ' end it 'can send invoices' do - accept_alert "An invoice for this order will be sent to the customer. "\ + accept_alert "An invoice for this order will be sent to the customer. " \ "Are you sure you want to continue?" do click_link "Send Invoice" end From bede52bdaefe42137df81a6efd039c951f52e5c9 Mon Sep 17 00:00:00 2001 From: Neal Chambers Date: Fri, 21 Jul 2023 22:47:21 +0900 Subject: [PATCH 5/7] Safely autocorrect Layout/LineLength Inspecting 1478 files .......C............................C..............................................................................................................C.......................................................................................................C............................................................................C................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................C.................C......................................C...................................................................................................................C...........................................................C........................C...C.....C..C..C..........C..................C...............C.....................C...................................................................................C......................................................C........C..C...........C....................C.CC....C....................................C......C.......................... Offenses: app/components/confirm_modal_component.rb:4:88: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected. def initialize(id:, confirm_actions: nil, reflex: nil, controller: nil, message: nil, ^ app/components/confirm_modal_component.rb:4:101: C: [Corrected] Layout/LineLength: Line is too long. [110/100] def initialize(id:, confirm_actions: nil, reflex: nil, controller: nil, message: nil, confirm_reflexes: nil) ^^^^^^^^^^ app/components/confirm_modal_component.rb:5:1: C: [Corrected] Layout/ParameterAlignment: Align the parameters of a method definition if they span more than one line. confirm_reflexes: nil) ^^^^^^^^^^^^^^^^^^^^^ app/controllers/admin/product_import_controller.rb:142:43: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected. redirect_to '/admin/product_import', ^ app/controllers/admin/product_import_controller.rb:142:101: C: [Corrected] Layout/LineLength: Line is too long. [104/100] redirect_to '/admin/product_import', notice: I18n.t(:product_import_no_data_in_spreadsheet_notice) ^^^^ app/controllers/admin/product_import_controller.rb:143:1: C: [Corrected] Layout/ArgumentAlignment: Align the arguments of a method call if they span more than one line. notice: I18n.t(:product_import_no_data_in_spreadsheet_notice) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ app/controllers/spree/users_controller.rb:53:101: C: Layout/LineLength: Line is too long. [107/100] message: t('devise.user_registrations.spree_user.signed_up_but_unconfirmed') }) ^^^^^^^ app/models/customer.rb:43:101: C: [Corrected] Layout/LineLength: Line is too long. [113/100] scope :managed_by, ->(user) { user&.persisted? ? where(user: user).or(of(Enterprise.managed_by(user))) : none } ^^^^^^^^^^^^^ app/models/customer.rb:44:1: C: [Corrected] Layout/IndentationWidth: Use 2 (not 1) spaces for indentation. user&.persisted? ? where(user: user).or(of(Enterprise.managed_by(user))) : none ^ app/models/customer.rb:44:3: C: [Corrected] Layout/IndentationWidth: Use 2 (not -19) spaces for indentation. user&.persisted? ? where(user: user).or(of(Enterprise.managed_by(user))) : none ^^^^^^^^^^^^^^^^^^^ app/models/customer.rb:44:82: C: [Corrected] Layout/BlockEndNewline: Expression at 44, 82 should be on its own line. user&.persisted? ? where(user: user).or(of(Enterprise.managed_by(user))) : none } ^ app/models/customer.rb:44:101: C: Layout/LineLength: Line is too long. [102/100] user&.persisted? ? where(user: user).or(of(Enterprise.managed_by(user))) : none ^^ app/models/customer.rb:45:1: C: [Corrected] Layout/BlockAlignment: } at 45, 0 is not aligned with ->(user) { at 43, 21 or scope :managed_by, ->(user) { at 43, 2. } ^ app/models/spree/line_item.rb:53:101: C: Layout/LineLength: Line is too long. [110/100] attr_accessor :skip_stock_check, :target_shipment # Allows manual skipping of Stock::AvailabilityValidator ^^^^^^^^^^ spec/controllers/admin/order_cycles_controller_spec.rb:38:101: C: Layout/LineLength: Line is too long. [108/100] it "loads order cycles that closed within the past month, and orders without a close_at date" do ^^^^^^^^ spec/controllers/admin/order_cycles_controller_spec.rb:48:101: C: Layout/LineLength: Line is too long. [111/100] it "loads order cycles that closed after the specified date, and orders without a close_at date" do ^^^^^^^^^^^ spec/controllers/admin/order_cycles_controller_spec.rb:100:101: C: Layout/LineLength: Line is too long. [125/100] expect(flash[:error]).to eq "You don't have permission to create an order cycle coordinated by that enterprise" ^^^^^^^^^^^^^^^^^^^^^^^^^ spec/controllers/admin/order_cycles_controller_spec.rb:125:101: C: Layout/LineLength: Line is too long. [101/100] order_cycle.exchanges.create! sender: distributor, receiver: distributor, incoming: true, ^ spec/controllers/admin/order_cycles_controller_spec.rb:127:101: C: Layout/LineLength: Line is too long. [102/100] order_cycle.exchanges.create! sender: distributor, receiver: distributor, incoming: false, ^^ spec/controllers/admin/order_cycles_controller_spec.rb:284:101: C: Layout/LineLength: Line is too long. [101/100] merge(order_cycle: { preferred_product_selection_from_coordinator_inventory_only: true }) ^ spec/controllers/admin/order_cycles_controller_spec.rb:311:101: C: Layout/LineLength: Line is too long. [104/100] create(:exchange, order_cycle: order_cycle, sender: coordinator, receiver: hub, incoming: false, ^^^^ spec/controllers/admin/order_cycles_controller_spec.rb:374:101: C: Layout/LineLength: Line is too long. [102/100] expect(json_response['errors']).to eq 'Hm, something went wrong. No order cycle data found.' ^^ spec/controllers/admin/order_cycles_controller_spec.rb:460:101: C: Layout/LineLength: Line is too long. [176/100] expect(flash[:error]).to eq 'That order cycle has been selected by a customer and cannot be deleted. To prevent customers from accessing it, please close it instead.' ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ spec/controllers/admin/order_cycles_controller_spec.rb:470:101: C: Layout/LineLength: Line is too long. [147/100] expect(flash[:error]).to eq 'That order cycle is linked to a schedule and cannot be deleted. Please unlink or delete the schedule first.' ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ spec/controllers/api/v0/order_cycles_controller_spec.rb:16:101: C: [Corrected] Layout/LineLength: Line is too long. [106/100] let!(:product1) { create(:product, name: "Kangaroo", primary_taxon: taxon1, properties: [property1]) } ^^^^^^ spec/controllers/api/v0/order_cycles_controller_spec.rb:17:1: C: [Corrected] Layout/IndentationWidth: Use 2 (not 1) spaces for indentation. create(:product, name: "Kangaroo", primary_taxon: taxon1, properties: [property1]) ^ spec/controllers/api/v0/order_cycles_controller_spec.rb:17:3: C: [Corrected] Layout/IndentationWidth: Use 2 (not -2) spaces for indentation. create(:product, name: "Kangaroo", primary_taxon: taxon1, properties: [property1]) ^^ spec/controllers/api/v0/order_cycles_controller_spec.rb:17:85: C: [Corrected] Layout/BlockEndNewline: Expression at 17, 85 should be on its own line. create(:product, name: "Kangaroo", primary_taxon: taxon1, properties: [property1]) } ^ spec/controllers/api/v0/order_cycles_controller_spec.rb:17:101: C: [Corrected] Layout/LineLength: Line is too long. [106/100] let!(:product2) { create(:product, name: "Parsnips", primary_taxon: taxon2, properties: [property2]) } ^^^^^^ spec/controllers/api/v0/order_cycles_controller_spec.rb:18:1: C: [Corrected] Layout/BlockAlignment: } at 18, 0 is not aligned with let!(:product1) { at 16, 4. } ^ spec/controllers/api/v0/order_cycles_controller_spec.rb:19:85: C: [Corrected] Layout/BlockEndNewline: Expression at 19, 85 should be on its own line. create(:product, name: "Parsnips", primary_taxon: taxon2, properties: [property2]) } ^ spec/controllers/api/v0/order_cycles_controller_spec.rb:20:1: C: [Corrected] Layout/IndentationWidth: Use 2 (not 1) spaces for indentation. create(:product, name: "Parsnips", primary_taxon: taxon2, properties: [property2]) ^ spec/controllers/api/v0/order_cycles_controller_spec.rb:20:3: C: [Corrected] Layout/IndentationWidth: Use 2 (not -2) spaces for indentation. create(:product, name: "Parsnips", primary_taxon: taxon2, properties: [property2]) ^^ spec/controllers/api/v0/order_cycles_controller_spec.rb:21:1: C: [Corrected] Layout/BlockAlignment: } at 21, 0 is not aligned with let!(:product2) { at 19, 4. } ^ spec/controllers/spree/admin/orders_controller_spec.rb:232:101: C: [Corrected] Layout/LineLength: Line is too long. [117/100] let!(:order_cycle){ create(:simple_order_cycle, distributors: [distributor], variants: [line_item.variant]) } ^^^^^^^^^^^^^^^^^ spec/controllers/spree/admin/orders_controller_spec.rb:233:1: C: [Corrected] Layout/IndentationWidth: Use 2 (not 1) spaces for indentation. create(:simple_order_cycle, distributors: [distributor], variants: [line_item.variant]) ^ spec/controllers/spree/admin/orders_controller_spec.rb:233:3: C: [Corrected] Layout/IndentationWidth: Use 2 (not -6) spaces for indentation. create(:simple_order_cycle, distributors: [distributor], variants: [line_item.variant]) ^^^^^^ spec/controllers/spree/admin/orders_controller_spec.rb:233:90: C: [Corrected] Layout/BlockEndNewline: Expression at 233, 90 should be on its own line. create(:simple_order_cycle, distributors: [distributor], variants: [line_item.variant]) } ^ spec/controllers/spree/admin/orders_controller_spec.rb:234:1: C: [Corrected] Layout/BlockAlignment: } at 234, 0 is not aligned with let!(:order_cycle){ at 232, 8. } ^ spec/controllers/spree/admin/orders_controller_spec.rb:252:101: C: Layout/LineLength: Line is too long. [109/100] allow_any_instance_of(Spree::Order).to receive(:ensure_available_shipping_rates).and_return(true) ^^^^^^^^^ spec/lib/reports/customers_report_spec.rb:93:88: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected. create(:order_with_totals_and_distribution, :completed, distributor: d, ^ spec/lib/reports/customers_report_spec.rb:93:101: C: [Corrected] Layout/LineLength: Line is too long. [125/100] create(:order_with_totals_and_distribution, :completed, distributor: d, bill_address: a, shipping_method: sm) ^^^^^^^^^^^^^^^^^^^^^^^^^ spec/lib/reports/customers_report_spec.rb:94:1: C: [Corrected] Layout/HashAlignment: Align the keys of a hash literal if they span more than one line. bill_address: a, shipping_method: sm) ^^^^^^^^^^^^^^^ spec/lib/reports/customers_report_spec.rb:94:101: C: Layout/LineLength: Line is too long. [109/100] bill_address: a, shipping_method: sm) ^^^^^^^^^ spec/lib/reports/customers_report_spec.rb:96:101: C: [Corrected] Layout/LineLength: Line is too long. [125/100] create(:order_with_totals_and_distribution, :completed, distributor: d, bill_address: a, shipping_method: sm) ^^^^^^^^^^^^^^^^^^^^^^^^^ spec/lib/reports/customers_report_spec.rb:97:88: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected. create(:order_with_totals_and_distribution, :completed, distributor: d, ^ spec/lib/reports/customers_report_spec.rb:98:1: C: [Corrected] Layout/HashAlignment: Align the keys of a hash literal if they span more than one line. bill_address: a, shipping_method: sm) ^^^^^^^^^^^^^^^ spec/lib/reports/customers_report_spec.rb:98:101: C: Layout/LineLength: Line is too long. [109/100] bill_address: a, shipping_method: sm) ^^^^^^^^^ spec/lib/reports/customers_report_spec.rb:113:101: C: Layout/LineLength: Line is too long. [118/100] [d.address.address1, d.address.address2, d.address.city].join(" "), ^^^^^^^^^^^^^^^^^^ spec/lib/reports/customers_report_spec.rb:120:101: C: [Corrected] Layout/LineLength: Line is too long. [129/100] create(:order_with_totals_and_distribution, :completed, distributor: d2, bill_address: a, shipping_method: sm2) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ spec/lib/reports/customers_report_spec.rb:122:91: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected. create(:order_with_totals_and_distribution, :completed, distributor: d2, ^ spec/lib/reports/customers_report_spec.rb:123:1: C: [Corrected] Layout/HashAlignment: Align the keys of a hash literal if they span more than one line. bill_address: a, shipping_method: sm2) ^^^^^^^^^^^^^^^ spec/lib/reports/customers_report_spec.rb:123:101: C: Layout/LineLength: Line is too long. [112/100] bill_address: a, shipping_method: sm2) ^^^^^^^^^^^^ spec/lib/reports/customers_report_spec.rb:133:101: C: Layout/LineLength: Line is too long. [120/100] [d.address.address1, d.address.address2, d.address.city].join(" "), ^^^^^^^^^^^^^^^^^^^^ spec/lib/reports/customers_report_spec.rb:139:101: C: Layout/LineLength: Line is too long. [123/100] [d2.address.address1, d2.address.address2, d2.address.city].join(" "), ^^^^^^^^^^^^^^^^^^^^^^^ spec/lib/reports/customers_report_spec.rb:145:101: C: [Corrected] Layout/LineLength: Line is too long. [128/100] create(:order_with_totals_and_distribution, :completed, distributor: d, bill_address: a, shipping_method: sm2) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ spec/lib/reports/customers_report_spec.rb:148:90: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected. create(:order_with_totals_and_distribution, :completed, distributor: d, ^ spec/lib/reports/customers_report_spec.rb:149:1: C: [Corrected] Layout/HashAlignment: Align the keys of a hash literal if they span more than one line. bill_address: a, shipping_method: sm2) ^^^^^^^^^^^^^^^ spec/lib/reports/customers_report_spec.rb:149:101: C: Layout/LineLength: Line is too long. [112/100] bill_address: a, shipping_method: sm2) ^^^^^^^^^^^^ spec/migrations/migrate_customer_names_spec.rb:16:101: C: Layout/LineLength: Line is too long. [122/100] value_type: "boolean", key: "/enterprise/show_customer_names_to_suppliers/#{enterprise1.id}") ^^^^^^^^^^^^^^^^^^^^^^ spec/migrations/migrate_customer_names_spec.rb:18:101: C: Layout/LineLength: Line is too long. [122/100] value_type: "boolean", key: "/enterprise/show_customer_names_to_suppliers/#{enterprise2.id}") ^^^^^^^^^^^^^^^^^^^^^^ spec/migrations/migrate_customer_names_spec.rb:20:101: C: Layout/LineLength: Line is too long. [122/100] value_type: "boolean", key: "/enterprise/show_customer_names_to_suppliers/#{enterprise4.id}") ^^^^^^^^^^^^^^^^^^^^^^ spec/models/enterprise_spec.rb:521:101: C: [Corrected] Layout/LineLength: Line is too long. [111/100] expect(Enterprise.supplying_variant_in([p1.variants.first, p2.variants.first])).to match_array [s1, s2] ^^^^^^^^^^^ spec/models/enterprise_spec.rb:522:1: C: [Corrected] Layout/ArrayAlignment: Align the elements of an array literal if they span more than one line. p2.variants.first])).to match_array [s1, s2] ^^^^^^^^^^^^^^^^^ spec/models/order_cycle_spec.rb:207:101: C: Layout/LineLength: Line is too long. [118/100] expect(oc.variants).to match_array [p0.variants.first, p1.variants.first, p2.variants.first, p2_v, p1_v_visible, ^^^^^^^^^^^^^^^^^^ spec/models/order_cycle_spec.rb:220:101: C: Layout/LineLength: Line is too long. [111/100] expect(oc.distributed_variants).to match_array [p1.variants.first, p2.variants.first, p2_v, p1_v_visible, ^^^^^^^^^^^ spec/models/product_importer_spec.rb:782:101: C: Layout/LineLength: Line is too long. [101/100] csv << [" Oats ", "\nPorridge Oats\n", "\r#{enterprise2.name}\r", "\t#{enterprise.name}\t", ^ spec/models/spree/ability_spec.rb:340:69: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected. [:admin, :index, :read, :edit, :update, :search, :destroy, ^ spec/models/spree/ability_spec.rb:340:101: C: [Corrected] Layout/LineLength: Line is too long. [101/100] [:admin, :index, :read, :edit, :update, :search, :destroy, :delete], for: p1.variants.first ^ spec/models/spree/ability_spec.rb:341:1: C: [Corrected] Layout/ArrayAlignment: Align the elements of an array literal if they span more than one line. :delete], for: p1.variants.first ^^^^^^^ spec/models/spree/ability_spec.rb:350:101: C: [Corrected] Layout/LineLength: Line is too long. [108/100] [:admin, :index, :read, :edit, :update, :search, :destroy, :delete], for: p_related.variants.first ^^^^^^^^ spec/models/spree/ability_spec.rb:351:69: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected. [:admin, :index, :read, :edit, :update, :search, :destroy, ^ spec/models/spree/ability_spec.rb:352:1: C: [Corrected] Layout/ArrayAlignment: Align the elements of an array literal if they span more than one line. :delete], for: p_related.variants.first ^^^^^^^ spec/models/spree/ability_spec.rb:379:101: C: [Corrected] Layout/LineLength: Line is too long. [101/100] [:admin, :index, :read, :create, :edit, :search, :update, :destroy], for: p2.variants.first ^ spec/models/spree/ability_spec.rb:381:68: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected. [:admin, :index, :read, :create, :edit, :search, :update, ^ spec/models/spree/ability_spec.rb:382:1: C: [Corrected] Layout/ArrayAlignment: Align the elements of an array literal if they span more than one line. :destroy], for: p2.variants.first ^^^^^^^^ spec/models/spree/adjustment_spec.rb:339:101: C: Layout/LineLength: Line is too long. [106/100] create(:tax_rate, included_in_price: true, calculator: ::Calculator::DefaultTax.new, zone: zone, ^^^^^^ spec/models/spree/adjustment_spec.rb:367:101: C: Layout/LineLength: Line is too long. [101/100] calculator: ::Calculator::FlatRate.new(preferred_amount: 50.0)) ^ spec/models/spree/adjustment_spec.rb:428:101: C: Layout/LineLength: Line is too long. [105/100] context "when enterprise fees inherit their tax_category from the product they are applied to" do ^^^^^ spec/models/spree/adjustment_spec.rb:443:101: C: Layout/LineLength: Line is too long. [101/100] calculator: ::Calculator::FlatRate.new(preferred_amount: 50.0)) ^ spec/models/spree/line_item_spec.rb:208:101: C: Layout/LineLength: Line is too long. [107/100] expect(LineItem.from_order_cycle(oc_order.order_cycle).first.id).to eq oc_order.line_items.first.id ^^^^^^^ spec/models/spree/line_item_spec.rb:342:101: C: Layout/LineLength: Line is too long. [102/100] Spree::Variant.find(variant.id).on_hand ^^ spec/models/spree/product_spec.rb:409:74: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected. create(:simple_order_cycle, suppliers: [s], distributors: [d1], ^ spec/models/spree/product_spec.rb:409:101: C: [Corrected] Layout/LineLength: Line is too long. [104/100] create(:simple_order_cycle, suppliers: [s], distributors: [d1], variants: [p1.variants.first]) ^^^^ spec/models/spree/product_spec.rb:410:1: C: [Corrected] Layout/HashAlignment: Align the keys of a hash literal if they span more than one line. variants: [p1.variants.first]) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ spec/models/spree/product_spec.rb:410:101: C: [Corrected] Layout/LineLength: Line is too long. [104/100] create(:simple_order_cycle, suppliers: [s], distributors: [d2], variants: [p2.variants.first]) ^^^^ spec/models/spree/product_spec.rb:411:74: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected. create(:simple_order_cycle, suppliers: [s], distributors: [d2], ^ spec/models/spree/product_spec.rb:412:1: C: [Corrected] Layout/HashAlignment: Align the keys of a hash literal if they span more than one line. variants: [p2.variants.first]) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ spec/models/spree/product_spec.rb:486:101: C: [Corrected] Layout/LineLength: Line is too long. [104/100] create(:simple_order_cycle, suppliers: [s], distributors: [d1], variants: [p1.variants.first]) ^^^^ spec/models/spree/product_spec.rb:487:101: C: [Corrected] Layout/LineLength: Line is too long. [104/100] create(:simple_order_cycle, suppliers: [s], distributors: [d2], variants: [p2.variants.first]) ^^^^ spec/models/spree/product_spec.rb:488:74: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected. create(:simple_order_cycle, suppliers: [s], distributors: [d1], ^ spec/models/spree/product_spec.rb:489:1: C: [Corrected] Layout/HashAlignment: Align the keys of a hash literal if they span more than one line. variants: [p1.variants.first]) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ spec/models/spree/product_spec.rb:490:74: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected. create(:simple_order_cycle, suppliers: [s], distributors: [d2], ^ spec/models/spree/product_spec.rb:491:1: C: [Corrected] Layout/HashAlignment: Align the keys of a hash literal if they span more than one line. variants: [p2.variants.first]) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ spec/models/spree/product_spec.rb:495:101: C: [Corrected] Layout/LineLength: Line is too long. [102/100] create(:simple_order_cycle, suppliers: [s], distributors: [d], variants: [p.variants.first]) ^^ spec/models/spree/product_spec.rb:499:73: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected. create(:simple_order_cycle, suppliers: [s], distributors: [d], ^ spec/models/spree/product_spec.rb:500:1: C: [Corrected] Layout/HashAlignment: Align the keys of a hash literal if they span more than one line. variants: [p.variants.first]) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ spec/models/spree/variant_spec.rb:356:101: C: Layout/LineLength: Line is too long. [108/100] it "lists any variants that are not listed as visible=false only for the relevant enterprise" do ^^^^^^^^ spec/models/spree/variant_spec.rb:479:101: C: Layout/LineLength: Line is too long. [108/100] expect_any_instance_of(OpenFoodNetwork::EnterpriseFeeCalculator).to receive(:fees_for).with(variant) { ^^^^^^^^ spec/models/spree/variant_spec.rb:494:101: C: Layout/LineLength: Line is too long. [116/100] expect_any_instance_of(OpenFoodNetwork::EnterpriseFeeCalculator).to receive(:fees_by_type_for).with(variant) { ^^^^^^^^^^^^^^^^ spec/models/spree/variant_spec.rb:704:101: C: Layout/LineLength: Line is too long. [115/100] expect_any_instance_of(VariantUnits::OptionValueNamer).to receive(:name).exactly(1).times.and_call_original ^^^^^^^^^^^^^^^ spec/requests/api/orders_spec.rb:167:88: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected. create(:order_with_line_items, line_items_count: 1, bill_address_id: nil, ^ spec/requests/api/orders_spec.rb:167:101: C: [Corrected] Layout/LineLength: Line is too long. [109/100] create(:order_with_line_items, line_items_count: 1, bill_address_id: nil, ship_address_id: nil) ^^^^^^^^^ spec/requests/api/orders_spec.rb:168:1: C: [Corrected] Layout/HashAlignment: Align the keys of a hash literal if they span more than one line. ship_address_id: nil) ^^^^^^^^^^^^^^^^^^^^ spec/services/products_renderer_spec.rb:91:101: C: Layout/LineLength: Line is too long. [101/100] { q: { with_properties: [property_organic.id] } }) ^ spec/services/products_renderer_spec.rb:100:101: C: Layout/LineLength: Line is too long. [101/100] { q: { with_properties: [property_organic.id] } }) ^ spec/services/products_renderer_spec.rb:118:101: C: Layout/LineLength: Line is too long. [101/100] { q: { with_properties: [property_organic.id] } }) ^ spec/support/request/web_helper.rb:96:84: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected. tomselect_wrapper.find(:css, '.ts-dropdown.multi .ts-dropdown-content .option', ^ spec/support/request/web_helper.rb:96:101: C: [Corrected] Layout/LineLength: Line is too long. [102/100] tomselect_wrapper.find(:css, '.ts-dropdown.multi .ts-dropdown-content .option', text: value).click ^^ spec/support/request/web_helper.rb:97:1: C: [Corrected] Layout/ArgumentAlignment: Align the arguments of a method call if they span more than one line. text: value).click ^^^^^^^^^^^ spec/system/admin/adjustments_spec.rb:29:101: C: [Corrected] Layout/LineLength: Line is too long. [197/100] let!(:tax_rate2) { create(:tax_rate, name: "TVA 20%", amount: 0.2, zone: default_tax_zone, included_in_price: true, tax_category: tax_category_included, calculator: Calculator::DefaultTax.new ) } ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ spec/system/admin/adjustments_spec.rb:30:1: C: [Corrected] Layout/IndentationWidth: Use 2 (not 1) spaces for indentation. create(:tax_rate, name: "TVA 20%", amount: 0.2, zone: default_tax_zone, included_in_price: true, ^ spec/system/admin/adjustments_spec.rb:30:3: C: [Corrected] Layout/IndentationWidth: Use 2 (not 0) spaces for indentation. create(:tax_rate, name: "TVA 20%", amount: 0.2, zone: default_tax_zone, included_in_price: true, spec/system/admin/adjustments_spec.rb:30:98: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected. create(:tax_rate, name: "TVA 20%", amount: 0.2, zone: default_tax_zone, included_in_price: true, ^ spec/system/admin/adjustments_spec.rb:30:101: C: [Corrected] Layout/LineLength: Line is too long. [177/100] create(:tax_rate, name: "TVA 20%", amount: 0.2, zone: default_tax_zone, included_in_price: true, tax_category: tax_category_included, calculator: Calculator::DefaultTax.new ) } ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ spec/system/admin/adjustments_spec.rb:30:177: C: [Corrected] Layout/BlockEndNewline: Expression at 30, 177 should be on its own line. create(:tax_rate, name: "TVA 20%", amount: 0.2, zone: default_tax_zone, included_in_price: true, tax_category: tax_category_included, calculator: Calculator::DefaultTax.new ) } ^ spec/system/admin/adjustments_spec.rb:31:1: C: [Corrected] Layout/HashAlignment: Align the keys of a hash literal if they span more than one line. tax_category: tax_category_included, calculator: Calculator::DefaultTax.new ) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ spec/system/admin/adjustments_spec.rb:32:1: C: [Corrected] Layout/BlockAlignment: } at 32, 0 is not aligned with let!(:tax_rate2) { at 29, 2. } ^ spec/system/admin/adjustments_spec.rb:41:101: C: Layout/LineLength: Line is too long. [134/100] shared_examples "when the enable_localized_number preference" do |adjustment_label, adjustment_amount, tax_category, tax, tax_total| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ spec/system/admin/adjustments_spec.rb:67:101: C: [Corrected] Layout/LineLength: Line is too long. [117/100] it_behaves_like "when the enable_localized_number preference", "Discount", "-2", "TVA 20%", "$0.33", "$-1.67" ^^^^^^^^^^^^^^^^^ spec/system/admin/adjustments_spec.rb:68:100: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected. it_behaves_like "when the enable_localized_number preference", "Discount", "-2", "TVA 20%", ^ spec/system/admin/adjustments_spec.rb:69:1: C: [Corrected] Layout/ArgumentAlignment: Align the arguments of a method call if they span more than one line. "$0.33", "$-1.67" ^^^^^^^ spec/system/admin/adjustments_spec.rb:71:101: C: [Corrected] Layout/LineLength: Line is too long. [120/100] it_behaves_like "when the enable_localized_number preference", "Late fee", "100", "TVA 20%", "$-16.67", "$83.33" ^^^^^^^^^^^^^^^^^^^^ spec/system/admin/adjustments_spec.rb:73:90: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected. it_behaves_like "when the enable_localized_number preference", "Late fee", "100", ^ spec/system/admin/adjustments_spec.rb:74:1: C: [Corrected] Layout/ArgumentAlignment: Align the arguments of a method call if they span more than one line. "TVA 20%", "$-16.67", "$83.33" ^^^^^^^^^ spec/system/admin/adjustments_spec.rb:77:101: C: [Corrected] Layout/LineLength: Line is too long. [113/100] it_behaves_like "when the enable_localized_number preference", "Discount", "-2", "GST", "$10.00", "$8.00" ^^^^^^^^^^^^^ spec/system/admin/adjustments_spec.rb:80:96: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected. it_behaves_like "when the enable_localized_number preference", "Discount", "-2", "GST", ^ spec/system/admin/adjustments_spec.rb:81:1: C: [Corrected] Layout/ArgumentAlignment: Align the arguments of a method call if they span more than one line. "$10.00", "$8.00" ^^^^^^^^ spec/system/admin/adjustments_spec.rb:81:101: C: [Corrected] Layout/LineLength: Line is too long. [113/100] it_behaves_like "when the enable_localized_number preference", "Late fee", "110", "GST", "$10.00", "$120" ^^^^^^^^^^^^^ spec/system/admin/adjustments_spec.rb:85:97: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected. it_behaves_like "when the enable_localized_number preference", "Late fee", "110", "GST", ^ spec/system/admin/adjustments_spec.rb:86:1: C: [Corrected] Layout/ArgumentAlignment: Align the arguments of a method call if they span more than one line. "$10.00", "$120" ^^^^^^^^ spec/system/admin/adjustments_spec.rb:93:101: C: [Corrected] Layout/LineLength: Line is too long. [117/100] it_behaves_like "when the enable_localized_number preference", "Discount", "-2", "TVA 20%", "$0.33", "$-1.67" ^^^^^^^^^^^^^^^^^ spec/system/admin/adjustments_spec.rb:97:101: C: [Corrected] Layout/LineLength: Line is too long. [120/100] it_behaves_like "when the enable_localized_number preference", "Late fee", "100", "TVA 20%", "$-16.67", "$83.33" ^^^^^^^^^^^^^^^^^^^^ spec/system/admin/adjustments_spec.rb:98:100: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected. it_behaves_like "when the enable_localized_number preference", "Discount", "-2", "TVA 20%", ^ spec/system/admin/adjustments_spec.rb:99:1: C: [Corrected] Layout/ArgumentAlignment: Align the arguments of a method call if they span more than one line. "$0.33", "$-1.67" ^^^^^^^ spec/system/admin/adjustments_spec.rb:103:90: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected. it_behaves_like "when the enable_localized_number preference", "Late fee", "100", ^ spec/system/admin/adjustments_spec.rb:103:101: C: [Corrected] Layout/LineLength: Line is too long. [113/100] it_behaves_like "when the enable_localized_number preference", "Discount", "-2", "GST", "$10.00", "$8.00" ^^^^^^^^^^^^^ spec/system/admin/adjustments_spec.rb:104:1: C: [Corrected] Layout/ArgumentAlignment: Align the arguments of a method call if they span more than one line. "TVA 20%", "$-16.67", "$83.33" ^^^^^^^^^ spec/system/admin/adjustments_spec.rb:107:101: C: [Corrected] Layout/LineLength: Line is too long. [113/100] it_behaves_like "when the enable_localized_number preference", "Late fee", "110", "GST", "$10.00", "$120" ^^^^^^^^^^^^^ spec/system/admin/adjustments_spec.rb:110:96: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected. it_behaves_like "when the enable_localized_number preference", "Discount", "-2", "GST", ^ spec/system/admin/adjustments_spec.rb:111:1: C: [Corrected] Layout/ArgumentAlignment: Align the arguments of a method call if they span more than one line. "$10.00", "$8.00" ^^^^^^^^ spec/system/admin/adjustments_spec.rb:115:97: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected. it_behaves_like "when the enable_localized_number preference", "Late fee", "110", "GST", ^ spec/system/admin/adjustments_spec.rb:116:1: C: [Corrected] Layout/ArgumentAlignment: Align the arguments of a method call if they span more than one line. "$10.00", "$120" ^^^^^^^^ spec/system/admin/bulk_order_management_spec.rb:268:101: C: Layout/LineLength: Line is too long. [105/100] text: "#{o1.bill_address.last_name}, #{o1.bill_address.first_name}" ^^^^^ spec/system/admin/bulk_order_management_spec.rb:1036:101: C: Layout/LineLength: Line is too long. [147/100] expect(page).to have_content "This operation will result in one or more empty orders, which will be cancelled. Do you wish to proceed?" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ spec/system/admin/bulk_order_management_spec.rb:1060:101: C: Layout/LineLength: Line is too long. [138/100] it "the user can confirm + wants to send email confirmation : line item is then deleted, order is canceled and email is sent" do ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ spec/system/admin/bulk_order_management_spec.rb:1072:101: C: Layout/LineLength: Line is too long. [134/100] it "the user can confirm + uncheck the restock option: line item is then deleted and order is canceled without retocking" do ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ spec/system/admin/customers_spec.rb:40:101: C: Layout/LineLength: Line is too long. [126/100] managed_distributor2.name], without_options: [unmanaged_distributor.name] ^^^^^^^^^^^^^^^^^^^^^^^^^^ spec/system/admin/order_cycles/simple_spec.rb:346:101: C: Layout/LineLength: Line is too long. [101/100] with_options: [schedule_of_other_managed_distributor.name] ^ spec/system/admin/order_cycles/simple_spec.rb:623:101: C: Layout/LineLength: Line is too long. [121/100] value: Time.zone.local(2040, 10, 17, 0o6, 0o0, 0o0).strftime("%F %T %z"), visible: false ^^^^^^^^^^^^^^^^^^^^^ spec/system/admin/order_cycles/simple_spec.rb:625:101: C: Layout/LineLength: Line is too long. [120/100] value: Time.zone.local(2040, 10, 24, 17, 0o0, 0o0).strftime("%F %T %z"), visible: false ^^^^^^^^^^^^^^^^^^^^ spec/system/admin/order_cycles/simple_spec.rb:733:101: C: Layout/LineLength: Line is too long. [121/100] value: Time.zone.local(2040, 10, 17, 0o6, 0o0, 0o0).strftime("%F %T %z"), visible: false ^^^^^^^^^^^^^^^^^^^^^ spec/system/admin/order_cycles/simple_spec.rb:735:101: C: Layout/LineLength: Line is too long. [120/100] value: Time.zone.local(2040, 10, 24, 17, 0o0, 0o0).strftime("%F %T %z"), visible: false ^^^^^^^^^^^^^^^^^^^^ spec/system/admin/order_spec.rb:598:101: C: [Corrected] Layout/LineLength: Line is too long. [101/100] expect(page).to have_link "Resend Confirmation", href: spree.resend_admin_order_path(order) ^ spec/system/admin/order_spec.rb:599:1: C: [Corrected] Layout/ArgumentAlignment: Align the arguments of a method call if they span more than one line. href: spree.resend_admin_order_path(order) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ spec/system/admin/order_spec.rb:616:101: C: [Corrected] Layout/LineLength: Line is too long. [105/100] expect(page).to have_link "Cancel Order", href: spree.fire_admin_order_path(order, e: 'cancel') ^^^^^ spec/system/admin/order_spec.rb:618:1: C: [Corrected] Layout/ArgumentAlignment: Align the arguments of a method call if they span more than one line. href: spree.fire_admin_order_path(order, e: 'cancel') ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ spec/system/admin/orders_spec.rb:259:101: C: Layout/LineLength: Line is too long. [109/100] distributor: distributor2, bill_address_id: nil, ship_address_id: nil) ^^^^^^^^^ spec/system/admin/product_import_spec.rb:573:101: C: Layout/LineLength: Line is too long. [106/100] expect(page).to have_content "line 4: Cabbage - On_hand incorrect value - On_demand incorrect value" ^^^^^^ spec/system/admin/product_import_spec.rb:574:101: C: Layout/LineLength: Line is too long. [108/100] expect(page).to have_content "line 5: Aubergine - On_hand incorrect value - On_demand incorrect value" ^^^^^^^^ spec/system/admin/product_import_spec.rb:583:101: C: Layout/LineLength: Line is too long. [102/100] csv << ["name", "producer", "category", "on_hand", "price", "on_demand", "units", "unit_type", ^^ spec/system/admin/product_import_spec.rb:585:101: C: Layout/LineLength: Line is too long. [106/100] csv << ["Beans", "User Enterprise", "Vegetables", "invalid", "3.50", "1", "0.5", "g", "Small Bag", ^^^^^^ spec/system/admin/product_import_spec.rb:587:101: C: Layout/LineLength: Line is too long. [103/100] csv << ["Potatoes", "User Enterprise", "Vegetables", "6", "6", "invalid", "5", "kg", "Big Bag", ^^^ spec/system/admin/product_import_spec.rb:589:101: C: Layout/LineLength: Line is too long. [106/100] csv << ["Cabbage", "User Enterprise", "Vegetables", "invalid", "1.5", "invalid", "1", "kg", "Bag", ^^^^^^ spec/system/admin/product_import_spec.rb:591:101: C: Layout/LineLength: Line is too long. [102/100] csv << ["Aubergine", "User Enterprise", "Vegetables", nil, "1.5", "invalid", "1", "kg", "Bag", ^^ spec/system/admin/product_import_spec.rb:607:101: C: Layout/LineLength: Line is too long. [114/100] expect(page).to have_content "line 4: Cabbage ( Bag ) - On_hand incorrect value - On_demand incorrect value" ^^^^^^^^^^^^^^ spec/system/admin/product_import_spec.rb:608:101: C: Layout/LineLength: Line is too long. [116/100] expect(page).to have_content "line 5: Aubergine ( Bag ) - On_hand incorrect value - On_demand incorrect value" ^^^^^^^^^^^^^^^^ spec/system/admin/product_import_spec.rb:617:101: C: Layout/LineLength: Line is too long. [102/100] csv << ["name", "producer", "category", "on_hand", "price", "on_demand", "units", "unit_type", ^^ spec/system/admin/product_import_spec.rb:619:101: C: Layout/LineLength: Line is too long. [101/100] csv << ["Beans", "User Enterprise", "Vegetables", "-1", "3.50", "1", "500", "g", "Small Bag", ^ spec/system/admin/product_import_spec.rb:641:101: C: Layout/LineLength: Line is too long. [114/100] expect(page).to have_content "line 4: Cabbage ( Bag ) - On_hand incorrect value - On_demand incorrect value" ^^^^^^^^^^^^^^ spec/system/admin/product_import_spec.rb:642:101: C: Layout/LineLength: Line is too long. [116/100] expect(page).to have_content "line 5: Aubergine ( Bag ) - On_hand incorrect value - On_demand incorrect value" ^^^^^^^^^^^^^^^^ spec/system/consumer/shopping/cart_spec.rb:147:101: C: Layout/LineLength: Line is too long. [101/100] preferred_unit_from_list: "kg"), ^ spec/system/consumer/shopping/products_spec.rb:98:101: C: Layout/LineLength: Line is too long. [113/100] "", truncate: false) ^^^^^^^^^^^^^ 1478 files inspected, 173 offenses detected, 106 offenses corrected --- .rubocop_todo.yml | 13 ++------- app/components/confirm_modal_component.rb | 3 +- .../admin/product_import_controller.rb | 3 +- app/models/customer.rb | 4 ++- .../api/v0/order_cycles_controller_spec.rb | 8 +++-- .../spree/admin/orders_controller_spec.rb | 4 ++- spec/lib/reports/customers_report_spec.rb | 12 +++++--- spec/models/enterprise_spec.rb | 3 +- spec/models/spree/ability_spec.rb | 9 ++++-- spec/models/spree/product_spec.rb | 15 ++++++---- spec/requests/api/orders_spec.rb | 3 +- spec/support/request/web_helper.rb | 3 +- spec/system/admin/adjustments_spec.rb | 29 +++++++++++++------ spec/system/admin/order_spec.rb | 6 ++-- 14 files changed, 72 insertions(+), 43 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 0f7e5b5daa..ec3f4df4ec 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -6,38 +6,29 @@ # Note that changes in the inspected code, or installation of new # versions of RuboCop, may require this file to be generated again. -# Offense count: 94 +# Offense count: 67 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: Max, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns. # URISchemes: http, https Layout/LineLength: Exclude: - - 'app/components/confirm_modal_component.rb' - - 'app/controllers/admin/product_import_controller.rb' - 'app/controllers/spree/users_controller.rb' - 'app/models/customer.rb' - 'app/models/spree/line_item.rb' - 'spec/controllers/admin/order_cycles_controller_spec.rb' - - 'spec/controllers/api/v0/order_cycles_controller_spec.rb' - 'spec/controllers/spree/admin/orders_controller_spec.rb' - 'spec/lib/reports/customers_report_spec.rb' - 'spec/migrations/migrate_customer_names_spec.rb' - - 'spec/models/enterprise_spec.rb' - 'spec/models/order_cycle_spec.rb' - 'spec/models/product_importer_spec.rb' - - 'spec/models/spree/ability_spec.rb' - 'spec/models/spree/adjustment_spec.rb' - 'spec/models/spree/line_item_spec.rb' - - 'spec/models/spree/product_spec.rb' - 'spec/models/spree/variant_spec.rb' - - 'spec/requests/api/orders_spec.rb' - 'spec/services/products_renderer_spec.rb' - - 'spec/support/request/web_helper.rb' - 'spec/system/admin/adjustments_spec.rb' - 'spec/system/admin/bulk_order_management_spec.rb' - 'spec/system/admin/customers_spec.rb' - 'spec/system/admin/order_cycles/simple_spec.rb' - - 'spec/system/admin/order_spec.rb' - 'spec/system/admin/orders_spec.rb' - 'spec/system/admin/product_import_spec.rb' - 'spec/system/consumer/shopping/cart_spec.rb' @@ -78,7 +69,7 @@ Layout/TrailingEmptyLines: Exclude: - 'Rakefile' -# Offense count: 77 +# Offense count: 80 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: AllowInHeredoc. Layout/TrailingWhitespace: diff --git a/app/components/confirm_modal_component.rb b/app/components/confirm_modal_component.rb index 4fd17dc908..f1419c579c 100644 --- a/app/components/confirm_modal_component.rb +++ b/app/components/confirm_modal_component.rb @@ -1,7 +1,8 @@ # frozen_string_literal: true class ConfirmModalComponent < ModalComponent - def initialize(id:, confirm_actions: nil, reflex: nil, controller: nil, message: nil, confirm_reflexes: nil) + def initialize(id:, confirm_actions: nil, reflex: nil, controller: nil, message: nil, + confirm_reflexes: nil) super(id: id, close_button: true) @confirm_actions = confirm_actions @reflex = reflex diff --git a/app/controllers/admin/product_import_controller.rb b/app/controllers/admin/product_import_controller.rb index 5802ee1b54..6d342b5cc6 100644 --- a/app/controllers/admin/product_import_controller.rb +++ b/app/controllers/admin/product_import_controller.rb @@ -139,7 +139,8 @@ module Admin end def raise_invalid_file_path - redirect_to '/admin/product_import', notice: I18n.t(:product_import_no_data_in_spreadsheet_notice) + redirect_to '/admin/product_import', + notice: I18n.t(:product_import_no_data_in_spreadsheet_notice) raise 'Invalid File Path' end TEMP_FILE_PATH_REGEX = %r{^/tmp/product_import[A-Za-z0-9-]*/import\.csv$} diff --git a/app/models/customer.rb b/app/models/customer.rb index c278d009ed..8157681269 100644 --- a/app/models/customer.rb +++ b/app/models/customer.rb @@ -40,7 +40,9 @@ class Customer < ApplicationRecord } scope :of, ->(enterprise) { where(enterprise_id: enterprise) } - scope :managed_by, ->(user) { user&.persisted? ? where(user: user).or(of(Enterprise.managed_by(user))) : none } + scope :managed_by, ->(user) { + user&.persisted? ? where(user: user).or(of(Enterprise.managed_by(user))) : none + } scope :created_manually, -> { where(created_manually: true) } scope :visible, -> { where(id: Spree::Order.complete.select(:customer_id)).or(created_manually) } diff --git a/spec/controllers/api/v0/order_cycles_controller_spec.rb b/spec/controllers/api/v0/order_cycles_controller_spec.rb index 8953f3cd8f..0eff7e3f2e 100644 --- a/spec/controllers/api/v0/order_cycles_controller_spec.rb +++ b/spec/controllers/api/v0/order_cycles_controller_spec.rb @@ -13,8 +13,12 @@ module Api let!(:property1) { create(:property, presentation: 'Organic') } let!(:property2) { create(:property, presentation: 'Dairy-Free') } let!(:property3) { create(:property, presentation: 'May Contain Nuts') } - let!(:product1) { create(:product, name: "Kangaroo", primary_taxon: taxon1, properties: [property1]) } - let!(:product2) { create(:product, name: "Parsnips", primary_taxon: taxon2, properties: [property2]) } + let!(:product1) { + create(:product, name: "Kangaroo", primary_taxon: taxon1, properties: [property1]) + } + let!(:product2) { + create(:product, name: "Parsnips", primary_taxon: taxon2, properties: [property2]) + } let!(:product3) { create(:product, primary_taxon: taxon2) } let!(:product4) { create(:product, primary_taxon: taxon3, properties: [property3]) } let!(:user) { create(:user) } diff --git a/spec/controllers/spree/admin/orders_controller_spec.rb b/spec/controllers/spree/admin/orders_controller_spec.rb index 739c88ae34..ad64e9e395 100644 --- a/spec/controllers/spree/admin/orders_controller_spec.rb +++ b/spec/controllers/spree/admin/orders_controller_spec.rb @@ -229,7 +229,9 @@ describe Spree::Admin::OrdersController, type: :controller do context "with line items" do let!(:distributor){ create(:distributor_enterprise) } let!(:shipment){ create(:shipment) } - let!(:order_cycle){ create(:simple_order_cycle, distributors: [distributor], variants: [line_item.variant]) } + let!(:order_cycle){ + create(:simple_order_cycle, distributors: [distributor], variants: [line_item.variant]) + } before do line_item.product.supplier = distributor diff --git a/spec/lib/reports/customers_report_spec.rb b/spec/lib/reports/customers_report_spec.rb index aa06cc94b0..0289a739a1 100644 --- a/spec/lib/reports/customers_report_spec.rb +++ b/spec/lib/reports/customers_report_spec.rb @@ -90,10 +90,12 @@ module Reporting let!(:d){ create(:distributor_enterprise) } let!(:sm) { create(:shipping_method, distributors: [d]) } let!(:o1) { - create(:order_with_totals_and_distribution, :completed, distributor: d, bill_address: a, shipping_method: sm) + create(:order_with_totals_and_distribution, :completed, distributor: d, + bill_address: a, shipping_method: sm) } let!(:o2) { - create(:order_with_totals_and_distribution, :completed, distributor: d, bill_address: a, shipping_method: sm) + create(:order_with_totals_and_distribution, :completed, distributor: d, + bill_address: a, shipping_method: sm) } before do [o1, o2].each do |order| @@ -117,7 +119,8 @@ module Reporting let!(:d2) { create(:distributor_enterprise) } let!(:sm2) { create(:shipping_method, distributors: [d2]) } let!(:o2) { - create(:order_with_totals_and_distribution, :completed, distributor: d2, bill_address: a, shipping_method: sm2) + create(:order_with_totals_and_distribution, :completed, distributor: d2, + bill_address: a, shipping_method: sm2) } it "returns one row per customer per hub" do @@ -142,7 +145,8 @@ module Reporting context "orders with different shipping methods" do let!(:sm2) { create(:shipping_method, distributors: [d], name: "Bike") } let!(:o2) { - create(:order_with_totals_and_distribution, :completed, distributor: d, bill_address: a, shipping_method: sm2) + create(:order_with_totals_and_distribution, :completed, distributor: d, + bill_address: a, shipping_method: sm2) } before do o2.select_shipping_method(sm2.id) diff --git a/spec/models/enterprise_spec.rb b/spec/models/enterprise_spec.rb index a53c1b5ff9..75f402a77b 100644 --- a/spec/models/enterprise_spec.rb +++ b/spec/models/enterprise_spec.rb @@ -518,7 +518,8 @@ describe Enterprise do p1 = create(:simple_product, supplier: s1) p2 = create(:simple_product, supplier: s2) - expect(Enterprise.supplying_variant_in([p1.variants.first, p2.variants.first])).to match_array [s1, s2] + expect(Enterprise.supplying_variant_in([p1.variants.first, + p2.variants.first])).to match_array [s1, s2] end it "does not return duplicates" do diff --git a/spec/models/spree/ability_spec.rb b/spec/models/spree/ability_spec.rb index 379329812d..37072ac513 100644 --- a/spec/models/spree/ability_spec.rb +++ b/spec/models/spree/ability_spec.rb @@ -337,7 +337,8 @@ describe Spree::Ability do is_expected.to have_ability([:admin, :read, :update, :bulk_update, :clone, :destroy], for: p1) is_expected.to have_ability( - [:admin, :index, :read, :edit, :update, :search, :destroy, :delete], for: p1.variants.first + [:admin, :index, :read, :edit, :update, :search, :destroy, + :delete], for: p1.variants.first ) end @@ -347,7 +348,8 @@ describe Spree::Ability do is_expected.to have_ability([:admin, :read, :update, :bulk_update, :clone, :destroy], for: p_related) is_expected.to have_ability( - [:admin, :index, :read, :edit, :update, :search, :destroy, :delete], for: p_related.variants.first + [:admin, :index, :read, :edit, :update, :search, :destroy, + :delete], for: p_related.variants.first ) end @@ -376,7 +378,8 @@ describe Spree::Ability do it "should not be able to read/write other enterprises' product variants" do is_expected.not_to have_ability( - [:admin, :index, :read, :create, :edit, :search, :update, :destroy], for: p2.variants.first + [:admin, :index, :read, :create, :edit, :search, :update, + :destroy], for: p2.variants.first ) end diff --git a/spec/models/spree/product_spec.rb b/spec/models/spree/product_spec.rb index 9e1c98ceef..e04ef54528 100644 --- a/spec/models/spree/product_spec.rb +++ b/spec/models/spree/product_spec.rb @@ -406,8 +406,10 @@ module Spree d2 = create(:distributor_enterprise) p1 = create(:product) p2 = create(:product) - create(:simple_order_cycle, suppliers: [s], distributors: [d1], variants: [p1.variants.first]) - create(:simple_order_cycle, suppliers: [s], distributors: [d2], variants: [p2.variants.first]) + create(:simple_order_cycle, suppliers: [s], distributors: [d1], + variants: [p1.variants.first]) + create(:simple_order_cycle, suppliers: [s], distributors: [d2], + variants: [p2.variants.first]) expect(Product.in_distributor(d1)).to eq([p1]) end @@ -483,8 +485,10 @@ module Spree d2 = create(:distributor_enterprise) p1 = create(:product) p2 = create(:product) - create(:simple_order_cycle, suppliers: [s], distributors: [d1], variants: [p1.variants.first]) - create(:simple_order_cycle, suppliers: [s], distributors: [d2], variants: [p2.variants.first]) + create(:simple_order_cycle, suppliers: [s], distributors: [d1], + variants: [p1.variants.first]) + create(:simple_order_cycle, suppliers: [s], distributors: [d2], + variants: [p2.variants.first]) expect(Product.in_supplier_or_distributor(d1)).to eq([p1]) end @@ -492,7 +496,8 @@ module Spree s = create(:supplier_enterprise) d = create(:distributor_enterprise) p = create(:product, supplier: s) - create(:simple_order_cycle, suppliers: [s], distributors: [d], variants: [p.variants.first]) + create(:simple_order_cycle, suppliers: [s], distributors: [d], + variants: [p.variants.first]) [s, d].each { |e| expect(Product.in_supplier_or_distributor(e)).to eq([p]) } end end diff --git a/spec/requests/api/orders_spec.rb b/spec/requests/api/orders_spec.rb index c99bcd3f98..891981ef5e 100644 --- a/spec/requests/api/orders_spec.rb +++ b/spec/requests/api/orders_spec.rb @@ -164,7 +164,8 @@ describe 'api/v0/orders', swagger_doc: 'v0/swagger.yaml', type: :request do } let!(:order_not_empty_no_address) { - create(:order_with_line_items, line_items_count: 1, bill_address_id: nil, ship_address_id: nil) + create(:order_with_line_items, line_items_count: 1, bill_address_id: nil, + ship_address_id: nil) } let(:'q[state_eq]') { "cart" } diff --git a/spec/support/request/web_helper.rb b/spec/support/request/web_helper.rb index c4ebf00118..b592bd728b 100644 --- a/spec/support/request/web_helper.rb +++ b/spec/support/request/web_helper.rb @@ -93,7 +93,8 @@ module WebHelper def tomselect_multiselect(value, options) tomselect_wrapper = page.find("[name='#{options[:from]}']").sibling(".ts-wrapper") tomselect_wrapper.find(".ts-control").click - tomselect_wrapper.find(:css, '.ts-dropdown.multi .ts-dropdown-content .option', text: value).click + tomselect_wrapper.find(:css, '.ts-dropdown.multi .ts-dropdown-content .option', + text: value).click end def tomselect_search_and_select(value, options) diff --git a/spec/system/admin/adjustments_spec.rb b/spec/system/admin/adjustments_spec.rb index b47d8b572d..228fb75c3e 100644 --- a/spec/system/admin/adjustments_spec.rb +++ b/spec/system/admin/adjustments_spec.rb @@ -26,7 +26,10 @@ describe ' let!(:tax_category_included) { create(:tax_category, name: 'TVA 20%', is_default: true) } let!(:default_tax_zone) { create(:zone, default_tax: true) } - let!(:tax_rate2) { create(:tax_rate, name: "TVA 20%", amount: 0.2, zone: default_tax_zone, included_in_price: true, tax_category: tax_category_included, calculator: Calculator::DefaultTax.new ) } + let!(:tax_rate2) { + create(:tax_rate, name: "TVA 20%", amount: 0.2, zone: default_tax_zone, included_in_price: true, + tax_category: tax_category_included, calculator: Calculator::DefaultTax.new ) + } before do order.finalize! @@ -64,21 +67,25 @@ describe ' context "included tax" do context "adding negative, taxed adjustments to an order" do - it_behaves_like "when the enable_localized_number preference", "Discount", "-2", "TVA 20%", "$0.33", "$-1.67" + it_behaves_like "when the enable_localized_number preference", "Discount", "-2", "TVA 20%", + "$0.33", "$-1.67" end context "adding positive, taxed adjustments to an order" do - it_behaves_like "when the enable_localized_number preference", "Late fee", "100", "TVA 20%", "$-16.67", "$83.33" + it_behaves_like "when the enable_localized_number preference", "Late fee", "100", + "TVA 20%", "$-16.67", "$83.33" end end context "added tax" do context "adding negative, taxed adjustments to an order" do - it_behaves_like "when the enable_localized_number preference", "Discount", "-2", "GST", "$10.00", "$8.00" + it_behaves_like "when the enable_localized_number preference", "Discount", "-2", "GST", + "$10.00", "$8.00" end context "adding positive, taxed adjustments to an order" do - it_behaves_like "when the enable_localized_number preference", "Late fee", "110", "GST", "$10.00", "$120" + it_behaves_like "when the enable_localized_number preference", "Late fee", "110", "GST", + "$10.00", "$120" end end end @@ -90,21 +97,25 @@ describe ' context "included tax" do context "adding negative, taxed adjustments to an order" do - it_behaves_like "when the enable_localized_number preference", "Discount", "-2", "TVA 20%", "$0.33", "$-1.67" + it_behaves_like "when the enable_localized_number preference", "Discount", "-2", "TVA 20%", + "$0.33", "$-1.67" end context "adding positive, taxed adjustments to an order" do - it_behaves_like "when the enable_localized_number preference", "Late fee", "100", "TVA 20%", "$-16.67", "$83.33" + it_behaves_like "when the enable_localized_number preference", "Late fee", "100", + "TVA 20%", "$-16.67", "$83.33" end end context "added tax" do context "adding negative, taxed adjustments to an order" do - it_behaves_like "when the enable_localized_number preference", "Discount", "-2", "GST", "$10.00", "$8.00" + it_behaves_like "when the enable_localized_number preference", "Discount", "-2", "GST", + "$10.00", "$8.00" end context "adding positive, taxed adjustments to an order" do - it_behaves_like "when the enable_localized_number preference", "Late fee", "110", "GST", "$10.00", "$120" + it_behaves_like "when the enable_localized_number preference", "Late fee", "110", "GST", + "$10.00", "$120" end end end diff --git a/spec/system/admin/order_spec.rb b/spec/system/admin/order_spec.rb index 4007224466..ea62c5e119 100644 --- a/spec/system/admin/order_spec.rb +++ b/spec/system/admin/order_spec.rb @@ -595,7 +595,8 @@ describe ' end it "shows the link" do - expect(page).to have_link "Resend Confirmation", href: spree.resend_admin_order_path(order) + expect(page).to have_link "Resend Confirmation", + href: spree.resend_admin_order_path(order) end it "resends the confirmation email" do @@ -613,7 +614,8 @@ describe ' end it "shows the link" do - expect(page).to have_link "Cancel Order", href: spree.fire_admin_order_path(order, e: 'cancel') + expect(page).to have_link "Cancel Order", + href: spree.fire_admin_order_path(order, e: 'cancel') end it "cancels the order" do From a677444a975f951131911f24368379b0d847d34b Mon Sep 17 00:00:00 2001 From: Maikel Linke Date: Mon, 24 Jul 2023 13:23:54 +1000 Subject: [PATCH 6/7] Fix specs with missign parenthesis --- .../complex_updating_specific_time_spec.rb | 5 +++-- spec/system/admin/order_cycles/simple_spec.rb | 10 ++++++---- spec/system/admin/product_import_spec.rb | 5 +++-- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/spec/system/admin/order_cycles/complex_updating_specific_time_spec.rb b/spec/system/admin/order_cycles/complex_updating_specific_time_spec.rb index df32676f34..6edf3953e0 100644 --- a/spec/system/admin/order_cycles/complex_updating_specific_time_spec.rb +++ b/spec/system/admin/order_cycles/complex_updating_specific_time_spec.rb @@ -80,8 +80,9 @@ xdescribe ' open_all_exchange_product_tabs - expect(page).to have_selector - "#order_cycle_incoming_exchange_1_variants_#{initial_variants.last.id}" + expect(page).to have_selector( + "#order_cycle_incoming_exchange_1_variants_#{initial_variants.last.id}" + ) # uncheck (with visible:true filter) page.find("#order_cycle_incoming_exchange_1_variants_#{initial_variants.last.id}").click check "order_cycle_incoming_exchange_2_variants_#{v1.id}" diff --git a/spec/system/admin/order_cycles/simple_spec.rb b/spec/system/admin/order_cycles/simple_spec.rb index 46759c34c2..4e64e005ad 100644 --- a/spec/system/admin/order_cycles/simple_spec.rb +++ b/spec/system/admin/order_cycles/simple_spec.rb @@ -780,15 +780,17 @@ describe ' def expect_payment_methods_to_be_checked_for(distributor) distributor.distributor_payment_method_ids.each do |distributor_payment_method_id| - expect(page).to have_checked_field - "order_cycle_selected_distributor_payment_method_ids_#{distributor_payment_method_id}" + expect(page).to have_checked_field( + "order_cycle_selected_distributor_payment_method_ids_#{distributor_payment_method_id}" + ) end end def expect_shipping_methods_to_be_checked_for(distributor) distributor.distributor_shipping_method_ids.each do |distributor_shipping_method_id| - expect(page).to have_checked_field - "order_cycle_selected_distributor_shipping_method_ids_#{distributor_shipping_method_id}" + expect(page).to have_checked_field( + "order_cycle_selected_distributor_shipping_method_ids_#{distributor_shipping_method_id}" + ) end end diff --git a/spec/system/admin/product_import_spec.rb b/spec/system/admin/product_import_spec.rb index 2692cacc06..f9c38aab50 100644 --- a/spec/system/admin/product_import_spec.rb +++ b/spec/system/admin/product_import_spec.rb @@ -814,8 +814,9 @@ describe "Product Import" do 'price', 'on_hand', 'shipping_category', 'name'] product_headings.each do |heading| - expect(page).to have_content - I18n.t("admin.product_import.product_headings.#{heading}").upcase + expect(page).to have_content( + I18n.t("admin.product_import.product_headings.#{heading}").upcase + ) end end end From f36ca77f5f39af1cf80660a4b7fc57cbe53dff17 Mon Sep 17 00:00:00 2001 From: Maikel Linke Date: Mon, 24 Jul 2023 13:31:09 +1000 Subject: [PATCH 7/7] Ease reading with related spec values on one line --- spec/system/admin/adjustments_spec.rb | 32 +++++++++++++-------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/spec/system/admin/adjustments_spec.rb b/spec/system/admin/adjustments_spec.rb index 228fb75c3e..6494e02bad 100644 --- a/spec/system/admin/adjustments_spec.rb +++ b/spec/system/admin/adjustments_spec.rb @@ -67,25 +67,25 @@ describe ' context "included tax" do context "adding negative, taxed adjustments to an order" do - it_behaves_like "when the enable_localized_number preference", "Discount", "-2", "TVA 20%", - "$0.33", "$-1.67" + it_behaves_like "when the enable_localized_number preference", + "Discount", "-2", "TVA 20%", "$0.33", "$-1.67" end context "adding positive, taxed adjustments to an order" do - it_behaves_like "when the enable_localized_number preference", "Late fee", "100", - "TVA 20%", "$-16.67", "$83.33" + it_behaves_like "when the enable_localized_number preference", + "Late fee", "100", "TVA 20%", "$-16.67", "$83.33" end end context "added tax" do context "adding negative, taxed adjustments to an order" do - it_behaves_like "when the enable_localized_number preference", "Discount", "-2", "GST", - "$10.00", "$8.00" + it_behaves_like "when the enable_localized_number preference", + "Discount", "-2", "GST", "$10.00", "$8.00" end context "adding positive, taxed adjustments to an order" do - it_behaves_like "when the enable_localized_number preference", "Late fee", "110", "GST", - "$10.00", "$120" + it_behaves_like "when the enable_localized_number preference", + "Late fee", "110", "GST", "$10.00", "$120" end end end @@ -97,25 +97,25 @@ describe ' context "included tax" do context "adding negative, taxed adjustments to an order" do - it_behaves_like "when the enable_localized_number preference", "Discount", "-2", "TVA 20%", - "$0.33", "$-1.67" + it_behaves_like "when the enable_localized_number preference", + "Discount", "-2", "TVA 20%", "$0.33", "$-1.67" end context "adding positive, taxed adjustments to an order" do - it_behaves_like "when the enable_localized_number preference", "Late fee", "100", - "TVA 20%", "$-16.67", "$83.33" + it_behaves_like "when the enable_localized_number preference", + "Late fee", "100", "TVA 20%", "$-16.67", "$83.33" end end context "added tax" do context "adding negative, taxed adjustments to an order" do - it_behaves_like "when the enable_localized_number preference", "Discount", "-2", "GST", - "$10.00", "$8.00" + it_behaves_like "when the enable_localized_number preference", + "Discount", "-2", "GST", "$10.00", "$8.00" end context "adding positive, taxed adjustments to an order" do - it_behaves_like "when the enable_localized_number preference", "Late fee", "110", "GST", - "$10.00", "$120" + it_behaves_like "when the enable_localized_number preference", + "Late fee", "110", "GST", "$10.00", "$120" end end end