diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 287ff33463..727207a1d3 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,6 +1,6 @@ # This configuration was generated by # `rubocop --auto-gen-config --auto-gen-only-exclude --exclude-limit 1400 --no-auto-gen-timestamp` -# using RuboCop version 1.52.1. +# using RuboCop version 1.54.1. # The point is for the user to remove these configuration records # one by one as the offenses are removed from the code base. # Note that changes in the inspected code, or installation of new @@ -16,7 +16,7 @@ Gemspec/RequiredRubyVersion: - 'engines/order_management/order_management.gemspec' - 'engines/web/web.gemspec' -# Offense count: 31 +# Offense count: 32 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: EnforcedStyle, IndentationWidth. # SupportedStyles: with_first_argument, with_fixed_indentation @@ -97,7 +97,7 @@ Layout/FirstHashElementIndentation: Exclude: - 'spec/services/products_renderer_spec.rb' -# Offense count: 10 +# Offense count: 13 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: AllowMultipleStyles, EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle. # SupportedHashRocketStyles: key, separator, table @@ -138,56 +138,16 @@ Layout/LeadingCommentSpace: Exclude: - 'spec/system/admin/enterprises_spec.rb' -# Offense count: 105 +# Offense count: 4 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: EnforcedStyle. # SupportedStyles: space, no_space Layout/LineContinuationSpacing: Exclude: - - 'spec/system/admin/bulk_order_management_spec.rb' - - 'spec/system/admin/configuration/content_spec.rb' - - 'spec/system/admin/customers_spec.rb' - 'spec/system/admin/enterprise_fees_spec.rb' - - 'spec/system/admin/enterprises/index_spec.rb' - - 'spec/system/admin/enterprises_spec.rb' - - 'spec/system/admin/order_cycles/list_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/overview_spec.rb' - - 'spec/system/admin/payment_method_spec.rb' - - 'spec/system/admin/product_import_spec.rb' - - 'spec/system/admin/subscriptions_spec.rb' - - 'spec/system/admin/tag_rules_spec.rb' - - 'spec/system/admin/users_spec.rb' - - 'spec/system/admin/variant_overrides_spec.rb' - - 'spec/system/consumer/authentication_spec.rb' - - 'spec/system/consumer/caching/shops_caching_spec.rb' - - 'spec/system/consumer/cookies_spec.rb' - - 'spec/system/consumer/shopping/cart_spec.rb' - - 'spec/system/consumer/shopping/checkout_spec.rb' - - 'spec/system/consumer/shopping/products_spec.rb' - - 'spec/system/consumer/shopping/shopping_spec.rb' - - 'spec/system/consumer/shopping/unit_price_spec.rb' - - 'spec/system/consumer/split_checkout_spec.rb' -# Offense count: 13 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: EnforcedStyle, IndentationWidth. -# SupportedStyles: aligned, indented -Layout/LineEndStringConcatenationIndentation: - Exclude: - - 'spec/system/admin/configuration/content_spec.rb' - - 'spec/system/admin/customers_spec.rb' - - 'spec/system/admin/overview_spec.rb' - - 'spec/system/admin/payment_method_spec.rb' - - 'spec/system/admin/subscriptions_spec.rb' - - 'spec/system/admin/tag_rules_spec.rb' - - 'spec/system/consumer/caching/shops_caching_spec.rb' - - 'spec/system/consumer/cookies_spec.rb' - - 'spec/system/consumer/shopping/cart_spec.rb' - -# Offense count: 209 +# Offense count: 77 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: Max, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns. # URISchemes: http, https @@ -208,38 +168,11 @@ Layout/LineLength: - 'spec/models/spree/adjustment_spec.rb' - 'spec/models/spree/line_item_spec.rb' - 'spec/models/spree/product_spec.rb' - - 'spec/models/spree/tax_rate_spec.rb' - - 'spec/models/spree/user_spec.rb' - 'spec/models/spree/variant_spec.rb' - - 'spec/models/tag_rule/filter_order_cycles_spec.rb' - - 'spec/models/tag_rule/filter_payment_methods_spec.rb' - - 'spec/models/tag_rule/filter_products_spec.rb' - - 'spec/models/tag_rule/filter_shipping_methods_spec.rb' - - 'spec/models/variant_override_spec.rb' - 'spec/requests/api/orders_spec.rb' - - 'spec/requests/checkout/failed_checkout_spec.rb' - - 'spec/serializers/api/admin/exchange_serializer_spec.rb' - - 'spec/serializers/api/admin/order_cycle_serializer_spec.rb' - - 'spec/services/address_geocoder_spec.rb' - - 'spec/services/cart_service_spec.rb' - - 'spec/services/checkout/post_checkout_actions_spec.rb' - - 'spec/services/content_sanitizer_spec.rb' - - 'spec/services/embedded_page_service_spec.rb' - - 'spec/services/exchange_products_renderer_spec.rb' - - 'spec/services/order_cycle_distributed_variants_spec.rb' - - 'spec/services/order_syncer_spec.rb' - - 'spec/services/paypal_items_builder_spec.rb' - - 'spec/services/permissions/order_spec.rb' - - 'spec/services/permitted_attributes/order_cycle_spec.rb' - - 'spec/services/product_tag_rules_filterer_spec.rb' - - 'spec/services/products_renderer_spec.rb' - - 'spec/support/cancan_helper.rb' - - 'spec/support/features/datepicker_helper.rb' - - 'spec/support/matchers/select2_matchers.rb' - 'spec/support/request/web_helper.rb' - 'spec/system/admin/adjustments_spec.rb' - 'spec/system/admin/bulk_order_management_spec.rb' - - 'spec/system/admin/bulk_product_update_spec.rb' - 'spec/system/admin/order_spec.rb' - 'spec/system/admin/product_import_spec.rb' @@ -404,6 +337,12 @@ Lint/NonAtomicFileOperation: Exclude: - 'app/services/bulk_invoice_service.rb' +# Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). +Lint/RedundantCopDisableDirective: + Exclude: + - 'app/components/product_component.rb' + # Offense count: 4 # This cop supports unsafe autocorrection (--autocorrect-all). Lint/RedundantDirGlobSort: @@ -477,7 +416,7 @@ Metrics/AbcSize: - 'lib/tasks/enterprises.rake' - 'spec/services/order_checkout_restart_spec.rb' -# Offense count: 48 +# Offense count: 45 # Configuration parameters: CountComments, Max, CountAsOne, AllowedMethods, AllowedPatterns. # AllowedMethods: refine Metrics/BlockLength: @@ -509,7 +448,6 @@ Metrics/BlockLength: - 'spec/system/consumer/shopping/checkout_spec.rb' - 'spec/system/consumer/shopping/checkout_stripe_spec.rb' - 'spec/system/consumer/shopping/variant_overrides_spec.rb' - - 'spec/system/consumer/split_checkout_tax_not_incl_spec.rb' # Offense count: 1 # Configuration parameters: CountBlocks, Max. @@ -1197,7 +1135,7 @@ Rails/UnknownEnv: Exclude: - 'app/models/spree/app_configuration.rb' -# Offense count: 55 +# Offense count: 56 # This cop supports unsafe autocorrection (--autocorrect-all). Rails/WhereEquals: Exclude: @@ -1438,7 +1376,7 @@ Style/HashLikeCase: Exclude: - 'app/models/enterprise.rb' -# Offense count: 1780 +# Offense count: 1782 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: EnforcedStyle, EnforcedShorthandSyntax, UseHashRocketsWithSymbolValues, PreferHashRocketsForNonAlnumEndingSymbols. # SupportedStyles: ruby19, hash_rockets, no_mixed_keys, ruby19_no_mixed_keys @@ -1882,7 +1820,7 @@ Style/NestedModifier: - 'spec/system/admin/payments_stripe_spec.rb' - 'spec/system/admin/reports_spec.rb' -# Offense count: 36 +# Offense count: 38 Style/OpenStructUse: Exclude: - 'app/helpers/injection_helper.rb' @@ -1976,11 +1914,12 @@ Style/RedundantInitialize: Exclude: - 'spec/models/spree/gateway_spec.rb' -# Offense count: 1 +# Offense count: 2 # This cop supports safe autocorrection (--autocorrect). -Style/RedundantRegexpEscape: +Style/RedundantRegexpArgument: Exclude: - - 'app/models/spree/order.rb' + - 'app/models/spree/shipping_method.rb' + - 'lib/spree/i18n.rb' # Offense count: 4 # This cop supports safe autocorrection (--autocorrect). @@ -1990,6 +1929,15 @@ Style/RedundantStringEscape: - 'spec/controllers/spree/admin/shipping_methods_controller_spec.rb' - 'spec/system/admin/enterprise_fees_spec.rb' +# Offense count: 19 +# This cop supports unsafe autocorrection (--autocorrect-all). +# Configuration parameters: AllowedMethods, AllowedPatterns. +Style/ReturnNilInPredicateMethodDefinition: + Exclude: + - 'app/models/order_cycle.rb' + - 'app/serializers/api/admin/customer_serializer.rb' + - 'engines/order_management/app/services/order_management/subscriptions/validator.rb' + # Offense count: 205 Style/Send: Exclude: diff --git a/spec/models/spree/tax_rate_spec.rb b/spec/models/spree/tax_rate_spec.rb index 6c0267dad3..bfd9f07767 100644 --- a/spec/models/spree/tax_rate_spec.rb +++ b/spec/models/spree/tax_rate_spec.rb @@ -344,7 +344,8 @@ module Spree end end - context "when order's zone is neither the default zone, or included in the default zone, but matches the rate's zone" do + context "when order's zone is neither the default zone, or included " \ + "in the default zone, but matches the rate's zone" do before do # With no zone members, this zone will not contain anything zone.zone_members.delete_all @@ -361,7 +362,8 @@ module Spree end end - context "when order's zone does not match default zone, is not included in the default zone, AND does not match the rate's zone" do + context "when order's zone does not match default zone, is not included in the " \ + "default zone, AND does not match the rate's zone" do let!(:other_country) { create(:country, name: "Other Country") } let!(:other_state) { create(:state, name: "Other State", country: other_country) } let!(:other_address) { create(:address, state: other_state, country: other_country) } diff --git a/spec/models/spree/user_spec.rb b/spec/models/spree/user_spec.rb index e7d1d727f8..53700326ad 100644 --- a/spec/models/spree/user_spec.rb +++ b/spec/models/spree/user_spec.rb @@ -15,9 +15,12 @@ describe Spree::User do old_bill_address = user.bill_address new_bill_address = create(:address, firstname: 'abc') - user.update(bill_address_attributes: new_bill_address.dup.attributes.merge('id' => old_bill_address.id).except!( - 'created_at', 'updated_at' - )) + user.update( + bill_address_attributes: new_bill_address.dup.attributes.merge( + 'id' => old_bill_address.id + ) + .except!('created_at', 'updated_at') + ) expect(user.bill_address.id).to eq old_bill_address.id expect(user.bill_address.firstname).to eq new_bill_address.firstname @@ -54,7 +57,8 @@ describe Spree::User do u2.owned_enterprises << e2 u2.save! end.to raise_error ActiveRecord::RecordInvalid, - "Validation failed: #{u2.email} is not permitted to own any more enterprises (limit is 1)." + "Validation failed: #{u2.email} is not permitted " \ + "to own any more enterprises (limit is 1)." end end diff --git a/spec/models/tag_rule/filter_order_cycles_spec.rb b/spec/models/tag_rule/filter_order_cycles_spec.rb index 311cbc61d3..661b18b8af 100644 --- a/spec/models/tag_rule/filter_order_cycles_spec.rb +++ b/spec/models/tag_rule/filter_order_cycles_spec.rb @@ -28,7 +28,7 @@ describe TagRule::FilterOrderCycles, type: :model do it { expect(tag_rule.send(:tags_match?, exchange_object)).to be false } end - context "when the rule has preferred exchange tags specified that match ANY of the exchange tags" do + context "when the rule has preferred exchange tags specified that match ANY exchange tags" do before { allow(tag_rule).to receive(:preferred_exchange_tags) { "wholesale,some_tag,member" @@ -37,7 +37,7 @@ describe TagRule::FilterOrderCycles, type: :model do it { expect(tag_rule.send(:tags_match?, exchange_object)).to be true } end - context "when the rule has preferred exchange tags specified that match NONE of the exchange tags" do + context "when the rule has preferred exchange tags specified that match NO exchange tags" do before { allow(tag_rule).to receive(:preferred_exchange_tags) { "wholesale,some_tag,some_other_tag" diff --git a/spec/models/tag_rule/filter_payment_methods_spec.rb b/spec/models/tag_rule/filter_payment_methods_spec.rb index adaeeae9eb..59d39aaacf 100644 --- a/spec/models/tag_rule/filter_payment_methods_spec.rb +++ b/spec/models/tag_rule/filter_payment_methods_spec.rb @@ -20,7 +20,7 @@ describe TagRule::FilterPaymentMethods, type: :model do it { expect(tag_rule.send(:tags_match?, payment_method)).to be false } end - context "when the rule has preferred customer tags specified that match ANY of the customer tags" do + context "when the rule has preferred customer tags specified that match ANY customer tags" do before { allow(tag_rule).to receive(:preferred_payment_method_tags) { "wholesale,some_tag,member" @@ -29,7 +29,7 @@ describe TagRule::FilterPaymentMethods, type: :model do it { expect(tag_rule.send(:tags_match?, payment_method)).to be true } end - context "when the rule has preferred customer tags specified that match NONE of the customer tags" do + context "when the rule has preferred customer tags specified that match NO customer tags" do before { allow(tag_rule).to receive(:preferred_payment_method_tags) { "wholesale,some_tag,some_other_tag" diff --git a/spec/models/tag_rule/filter_products_spec.rb b/spec/models/tag_rule/filter_products_spec.rb index 4a72cb2170..f0a8bcc31b 100644 --- a/spec/models/tag_rule/filter_products_spec.rb +++ b/spec/models/tag_rule/filter_products_spec.rb @@ -20,7 +20,7 @@ describe TagRule::FilterProducts, type: :model do it { expect(tag_rule.send(:tags_match?, variant_object)).to be false } end - context "when the rule has preferred variant tags specified that match ANY of the variant tags" do + context "when the rule has preferred variant tags specified that match ANY variant tags" do before { allow(tag_rule).to receive(:preferred_variant_tags) { "wholesale,some_tag,member" @@ -29,7 +29,7 @@ describe TagRule::FilterProducts, type: :model do it { expect(tag_rule.send(:tags_match?, variant_object)).to be true } end - context "when the rule has preferred variant tags specified that match NONE of the variant tags" do + context "when the rule has preferred variant tags specified that match NO variant tags" do before { allow(tag_rule).to receive(:preferred_variant_tags) { "wholesale,some_tag,some_other_tag" diff --git a/spec/models/tag_rule/filter_shipping_methods_spec.rb b/spec/models/tag_rule/filter_shipping_methods_spec.rb index a326fe5a04..3a6b410b60 100644 --- a/spec/models/tag_rule/filter_shipping_methods_spec.rb +++ b/spec/models/tag_rule/filter_shipping_methods_spec.rb @@ -22,7 +22,7 @@ describe TagRule::FilterShippingMethods, type: :model do it { expect(tag_rule.send(:tags_match?, shipping_method)).to be false } end - context "when the rule has preferred customer tags specified that match ANY of the customer tags" do + context "when rule has preferred customer tags specified that match ANY customer tags" do before { allow(tag_rule).to receive(:preferred_shipping_method_tags) { "wholesale,some_tag,member" @@ -31,7 +31,7 @@ describe TagRule::FilterShippingMethods, type: :model do it { expect(tag_rule.send(:tags_match?, shipping_method)).to be true } end - context "when the rule has preferred customer tags specified that match NONE of the customer tags" do + context "when rule has preferred customer tags specified that match NO customer tags" do before { allow(tag_rule).to receive(:preferred_shipping_method_tags) { "wholesale,some_tag,some_other_tag" diff --git a/spec/models/variant_override_spec.rb b/spec/models/variant_override_spec.rb index 734dc0b304..7b03fd33f2 100644 --- a/spec/models/variant_override_spec.rb +++ b/spec/models/variant_override_spec.rb @@ -286,7 +286,8 @@ describe VariantOverride do it "succeeds for variant override that uses producer stock settings" do vo = create(:variant_override, :use_producer_stock_settings, variant: variant, hub: hub, - default_stock: 20, resettable: true) + default_stock: 20, + resettable: true) vo.reset_stock! vo.reload diff --git a/spec/requests/api/orders_spec.rb b/spec/requests/api/orders_spec.rb index e0ce11fbcd..c99bcd3f98 100644 --- a/spec/requests/api/orders_spec.rb +++ b/spec/requests/api/orders_spec.rb @@ -6,7 +6,8 @@ describe 'api/v0/orders', swagger_doc: 'v0/swagger.yaml', type: :request do path '/api/v0/orders' do get('list orders') do tags 'Orders' - # type should be replaced with swagger 3.01 valid schema: {type: string} when rswag #317 is resolved: + # type should be replaced with swagger 3.01 valid schema: + # {type: string} when rswag #317 is resolved: # https://github.com/rswag/rswag/pull/319 parameter name: 'X-Spree-Token', in: :header, type: :string parameter name: 'q[distributor_id_eq]', in: :query, type: :string, required: false, @@ -18,7 +19,8 @@ describe 'api/v0/orders', swagger_doc: 'v0/swagger.yaml', type: :request do parameter name: 'q[state_eq]', in: :query, type: :string, required: false, description: "Query orders by order state, eg 'cart', 'complete'." parameter name: 'q[payment_state_eq]', in: :query, type: :string, required: false, - description: "Query orders by order payment_state, eg 'balance_due', 'paid', 'failed'." + description: "Query orders by order payment_state, eg 'balance_due', " \ + "'paid', 'failed'." parameter name: 'q[email_cont]', in: :query, type: :string, required: false, description: "Query orders where the order email contains a string." parameter name: 'q[order_cycle_id_eq]', in: :query, type: :string, required: false, @@ -42,8 +44,10 @@ describe 'api/v0/orders', swagger_doc: 'v0/swagger.yaml', type: :request do let!(:order_dist_2) { create(:order_with_totals_and_distribution) } let!(:li2) { create(:line_item, order: order_dist_2) } let!(:order_dist_1_complete) { - create(:completed_order_with_totals, distributor: order_dist_1.distributor, state: 'complete', - completed_at: Time.zone.today - 7.days, line_items_count: 1) + create(:completed_order_with_totals, distributor: order_dist_1.distributor, + state: 'complete', + completed_at: Time.zone.today - 7.days, + line_items_count: 1) } let!(:order_dist_1_credit_owed) { create(:order, distributor: order_dist_1.distributor, payment_state: 'credit_owed', diff --git a/spec/requests/checkout/failed_checkout_spec.rb b/spec/requests/checkout/failed_checkout_spec.rb index 25c98f7bcd..7885e02c07 100644 --- a/spec/requests/checkout/failed_checkout_spec.rb +++ b/spec/requests/checkout/failed_checkout_spec.rb @@ -29,16 +29,20 @@ describe "checking out an order that initially fails", type: :request do shipping_method_id: shipping_method.id, payments_attributes: [{ payment_method_id: payment_method.id }], bill_address_attributes: address.attributes.slice("firstname", "lastname", "address1", - "address2", "phone", "city", "zipcode", "state_id", "country_id"), + "address2", "phone", "city", "zipcode", + "state_id", "country_id"), ship_address_attributes: address.attributes.slice("firstname", "lastname", "address1", - "address2", "phone", "city", "zipcode", "state_id", "country_id") + "address2", "phone", "city", "zipcode", + "state_id", "country_id") } } end before do order_cycle_distributed_variants = double(:order_cycle_distributed_variants) - allow(OrderCycleDistributedVariants).to receive(:new).and_return(order_cycle_distributed_variants) - allow(order_cycle_distributed_variants).to receive(:distributes_order_variants?).and_return(true) + allow(OrderCycleDistributedVariants).to receive(:new) + .and_return(order_cycle_distributed_variants) + allow(order_cycle_distributed_variants) + .to receive(:distributes_order_variants?).and_return(true) order.reload.update_totals set_order order @@ -62,7 +66,8 @@ describe "checking out an order that initially fails", type: :request do # Checking out a BogusGateway without a source fails at :payment # Shipments and payments should then be cleared before rendering checkout expect(response.status).to be 400 - expect(flash[:error]).to eq 'Payment could not be processed, please check the details you entered' + expect(flash[:error]) + .to eq 'Payment could not be processed, please check the details you entered' order.reload expect(order.shipments.count).to be 0 expect(order.payments.count).to be 0 diff --git a/spec/serializers/api/admin/exchange_serializer_spec.rb b/spec/serializers/api/admin/exchange_serializer_spec.rb index aeaba4f396..7d55721205 100644 --- a/spec/serializers/api/admin/exchange_serializer_spec.rb +++ b/spec/serializers/api/admin/exchange_serializer_spec.rb @@ -28,15 +28,16 @@ describe Api::Admin::ExchangeSerializer do context "when order cycle shows only variants in the coordinator's inventory" do before do - allow(exchange.order_cycle).to receive(:prefers_product_selection_from_coordinator_inventory_only?) { - true - } + allow(exchange.order_cycle) + .to receive(:prefers_product_selection_from_coordinator_inventory_only?) { true } end it "filters variants within the exchange based on permissions, and visibility in inventory" do visible_variants = serializer.variants - expect(permissions_mock).to have_received(:visible_variants_for_incoming_exchanges_from).with(exchange.sender) - expect(permitted_variants).to have_received(:visible_for).with(exchange.order_cycle.coordinator) + expect(permissions_mock).to have_received(:visible_variants_for_incoming_exchanges_from) + .with(exchange.sender) + expect(permitted_variants).to have_received(:visible_for) + .with(exchange.order_cycle.coordinator) expect(exchange.variants).to include v1, v2, v3 expect(visible_variants.keys).to include v1.id expect(visible_variants.keys).to_not include v2.id, v3.id @@ -45,14 +46,14 @@ describe Api::Admin::ExchangeSerializer do context "when order cycle shows all available products" do before do - allow(exchange.order_cycle).to receive(:prefers_product_selection_from_coordinator_inventory_only?) { - false - } + allow(exchange.order_cycle) + .to receive(:prefers_product_selection_from_coordinator_inventory_only?) { false } end it "filters variants within the exchange based on permissions only" do visible_variants = serializer.variants - expect(permissions_mock).to have_received(:visible_variants_for_incoming_exchanges_from).with(exchange.sender) + expect(permissions_mock).to have_received(:visible_variants_for_incoming_exchanges_from) + .with(exchange.sender) expect(permitted_variants).to_not have_received(:visible_for) expect(exchange.variants).to include v1, v2, v3 expect(visible_variants.keys).to include v1.id, v2.id @@ -78,14 +79,14 @@ describe Api::Admin::ExchangeSerializer do context "when the receiver prefers to see all variants (not just those in their inventory)" do before do - allow(exchange.receiver).to receive(:prefers_product_selection_from_inventory_only?) { - false - } + allow(exchange.receiver) + .to receive(:prefers_product_selection_from_inventory_only?) { false } end it "filters variants within the exchange based on permissions only" do visible_variants = serializer.variants - expect(permissions_mock).to have_received(:visible_variants_for_outgoing_exchanges_to).with(exchange.receiver) + expect(permissions_mock).to have_received(:visible_variants_for_outgoing_exchanges_to) + .with(exchange.receiver) expect(permitted_variants).to have_received(:not_hidden_for).with(exchange.receiver) expect(permitted_variants).to_not have_received(:visible_for) expect(exchange.variants).to include v1, v2, v3 @@ -94,16 +95,17 @@ describe Api::Admin::ExchangeSerializer do end end - context "when the receiver prefers to restrict visible variants to only those in their inventory" do + context "when the receiver prefers to restrict visible variants " \ + "to only those in their inventory" do before do - allow(exchange.receiver).to receive(:prefers_product_selection_from_inventory_only?) { - true - } + allow(exchange.receiver) + .to receive(:prefers_product_selection_from_inventory_only?) { true } end it "filters variants within the exchange based on permissions, and inventory visibility" do visible_variants = serializer.variants - expect(permissions_mock).to have_received(:visible_variants_for_outgoing_exchanges_to).with(exchange.receiver) + expect(permissions_mock).to have_received(:visible_variants_for_outgoing_exchanges_to) + .with(exchange.receiver) expect(permitted_variants).to have_received(:visible_for).with(exchange.receiver) expect(permitted_variants).to_not have_received(:not_hidden_for) expect(exchange.variants).to include v1, v2, v3 diff --git a/spec/serializers/api/admin/order_cycle_serializer_spec.rb b/spec/serializers/api/admin/order_cycle_serializer_spec.rb index 80719d0097..b3badb7672 100644 --- a/spec/serializers/api/admin/order_cycle_serializer_spec.rb +++ b/spec/serializers/api/admin/order_cycle_serializer_spec.rb @@ -26,7 +26,8 @@ describe Api::Admin::OrderCycleSerializer do end it "serializes the order cycle with editable_variants_for_outgoing_exchanges" do - expect(serializer.editable_variants_for_outgoing_exchanges.to_json).to include order_cycle.variants.first.id.to_s + expect(serializer.editable_variants_for_outgoing_exchanges.to_json) + .to include order_cycle.variants.first.id.to_s end def from_json(serializer_result) diff --git a/spec/services/address_geocoder_spec.rb b/spec/services/address_geocoder_spec.rb index 0df81ae6d3..1215c95e1b 100644 --- a/spec/services/address_geocoder_spec.rb +++ b/spec/services/address_geocoder_spec.rb @@ -18,7 +18,8 @@ describe AddressGeocoder do end it "formats the address into a single comma separated string when passing it to the geocoder" do - expect(Geocoder).to receive(:coordinates).with("12 Galvin Street, Unit 1, 3018, Altona, Australia, Victoria") + expect(Geocoder).to receive(:coordinates) + .with("12 Galvin Street, Unit 1, 3018, Altona, Australia, Victoria") AddressGeocoder.new(address).geocode end diff --git a/spec/services/cart_service_spec.rb b/spec/services/cart_service_spec.rb index fc0117377b..05f574ba89 100644 --- a/spec/services/cart_service_spec.rb +++ b/spec/services/cart_service_spec.rb @@ -284,13 +284,14 @@ describe CartService do let(:order_cycle_distributed_variants) { double(:order_cycle_distributed_variants) } before do - expect(OrderCycleDistributedVariants).to receive(:new).with(234, - 123).and_return(order_cycle_distributed_variants) + expect(OrderCycleDistributedVariants) + .to receive(:new).with(234, 123).and_return(order_cycle_distributed_variants) cart_service.instance_eval { @distributor = 123; @order_cycle = 234 } end it "delegates to OrderCycleDistributedVariants, returning true when available" do - expect(order_cycle_distributed_variants).to receive(:available_variants).and_return([variant]) + expect(order_cycle_distributed_variants).to receive(:available_variants) + .and_return([variant]) expect(cart_service.send(:check_variant_available_under_distribution, variant)).to be true expect(cart_service.errors).to be_empty @@ -300,7 +301,8 @@ describe CartService do expect(order_cycle_distributed_variants).to receive(:available_variants).and_return([]) expect(cart_service.send(:check_variant_available_under_distribution, variant)).to be false - expect(cart_service.errors.to_a).to eq(["That product is not available from the chosen distributor or order cycle."]) + expect(cart_service.errors.to_a) + .to eq(["That product is not available from the chosen distributor or order cycle."]) end end end diff --git a/spec/services/checkout/post_checkout_actions_spec.rb b/spec/services/checkout/post_checkout_actions_spec.rb index 17e1edb8e1..fb8db90b98 100644 --- a/spec/services/checkout/post_checkout_actions_spec.rb +++ b/spec/services/checkout/post_checkout_actions_spec.rb @@ -13,7 +13,8 @@ describe Checkout::PostCheckoutActions do describe "setting customer terms_and_conditions_accepted_at" do before { order.customer = build(:customer) } - it "does not set customer's terms_and_conditions to the current time if terms have not been accepted" do + it "does not set customer's terms_and_conditions to the current time " \ + "if terms have not been accepted" do postCheckoutActions.success(params, current_user) expect(order.customer.terms_and_conditions_accepted_at).to be_nil end diff --git a/spec/services/content_sanitizer_spec.rb b/spec/services/content_sanitizer_spec.rb index 6961d8e574..1773c5c9fb 100644 --- a/spec/services/content_sanitizer_spec.rb +++ b/spec/services/content_sanitizer_spec.rb @@ -7,7 +7,8 @@ describe ContentSanitizer do context "#strip_content" do it "strips disallowed tags" do - expect(service.strip_content("I'm friendly!")).to eq("I'm friendly!") + expect(service.strip_content("I'm friendly!")) + .to eq("I'm friendly!") end it "replaces spaces" do @@ -55,7 +56,8 @@ describe ContentSanitizer do end it "removes empty
tags and keeps non-empty ones" do - expect(service.sanitize_content("
hello
world!
")).to eq("hello
world!
") + expect(service.sanitize_content("
hello
world!
")) + .to eq("hello
world!
") end end end diff --git a/spec/services/embedded_page_service_spec.rb b/spec/services/embedded_page_service_spec.rb index e6b8ef3749..54102f4321 100644 --- a/spec/services/embedded_page_service_spec.rb +++ b/spec/services/embedded_page_service_spec.rb @@ -38,7 +38,8 @@ describe EmbeddedPageService do it "sets session variables" do expect(session[:embedded_shopfront]).to eq true expect(session[:embedding_domain]).to eq 'embedding-enterprise.com' - expect(session[:shopfront_redirect]).to eq '/' + enterprise_slug + '/shop?embedded_shopfront=true' + expect(session[:shopfront_redirect]) + .to eq '/' + enterprise_slug + '/shop?embedded_shopfront=true' end it "publicly reports that embedded layout should be used" do @@ -56,7 +57,8 @@ describe EmbeddedPageService do it "resets the session variables for the new request" do expect(session[:embedded_shopfront]).to eq true expect(session[:embedding_domain]).to eq 'embedding-enterprise.com' - expect(session[:shopfront_redirect]).to eq '/' + enterprise_slug + '/shop?embedded_shopfront=true' + expect(session[:shopfront_redirect]) + .to eq '/' + enterprise_slug + '/shop?embedded_shopfront=true' end end diff --git a/spec/services/exchange_products_renderer_spec.rb b/spec/services/exchange_products_renderer_spec.rb index f2c5fd7bc6..2c7863c013 100644 --- a/spec/services/exchange_products_renderer_spec.rb +++ b/spec/services/exchange_products_renderer_spec.rb @@ -74,7 +74,8 @@ describe ExchangeProductsRenderer do exchange = order_cycle.exchanges.incoming.first variants = renderer.exchange_variants(true, exchange.sender) - expect(variants.first.product.supplier.name).to eq exchange.variants.first.product.supplier.name + expect(variants.first.product.supplier.name) + .to eq exchange.variants.first.product.supplier.name end describe "when OC is showing only the coordinators inventory" do @@ -82,11 +83,13 @@ describe ExchangeProductsRenderer do let(:exchange_with_hidden_variant) { order_cycle.exchanges.incoming.first } let!(:visible_inventory_item) { create(:inventory_item, enterprise: order_cycle.coordinator, - variant: exchange_with_visible_variant.variants.first, visible: true) + variant: exchange_with_visible_variant.variants.first, + visible: true) } let!(:hidden_inventory_item) { create(:inventory_item, enterprise: order_cycle.coordinator, - variant: exchange_with_hidden_variant.variants.first, visible: false) + variant: exchange_with_hidden_variant.variants.first, + visible: false) } before do diff --git a/spec/services/order_cycle_distributed_variants_spec.rb b/spec/services/order_cycle_distributed_variants_spec.rb index 33233f002d..672f33a3e5 100644 --- a/spec/services/order_cycle_distributed_variants_spec.rb +++ b/spec/services/order_cycle_distributed_variants_spec.rb @@ -26,7 +26,8 @@ describe OrderCycleDistributedVariants do describe "finding variants that are available through a particular order cycle" do it "finds variants distributed by order cycle" do variant = double(:variant) - allow(order_cycle).to receive(:variants_distributed_by).with(distributor).and_return([variant]) + allow(order_cycle).to receive(:variants_distributed_by) + .with(distributor).and_return([variant]) expect(subject.available_variants).to eq [variant] end diff --git a/spec/services/order_syncer_spec.rb b/spec/services/order_syncer_spec.rb index 043de15076..01ba4ef75c 100644 --- a/spec/services/order_syncer_spec.rb +++ b/spec/services/order_syncer_spec.rb @@ -29,30 +29,34 @@ describe OrderSyncer do end end - context "when the shipping method on a shipment is not the same as the original shipping method on the subscription" do + context "when the shipping method on a shipment is not the same " \ + "as the original shipping method on the subscription" do let(:params) { { shipping_method_id: new_shipping_method.id } } - context "when the shipping method on a shipment is the same as the new shipping method on the subscription" do + context "when the shipping method on a shipment is the same as the new shipping method " \ + "on the subscription" do before do # Create shipping rates for available shipping methods. order.shipments.each(&:refresh_rates) # Updating the shipping method on a shipment updates the shipping method on the order, - # and vice-versa via logic in Spree's shipments controller. So updating both here mimics that - # behaviour. + # and vice-versa via logic in Spree's shipments controller. So updating both here mimics + # that behaviour. order.select_shipping_method(new_shipping_method.id) subscription.assign_attributes(params) expect(syncer.sync!).to be true end - it "does not update the shipping_method on the subscription or on the pre-altered shipment" do + it "does not update the shipping_method on the subscription or " \ + "on the pre-altered shipment" do expect(order.reload.shipping_method).to eq new_shipping_method expect(order.reload.shipments.first.shipping_method).to eq new_shipping_method expect(syncer.order_update_issues[order.id]).to be nil end end - context "when the shipping method on a shipment is not the same as the new shipping method on the subscription" do + context "when the shipping method on a shipment is not the same as the new shipping method " \ + "on the subscription" do let!(:changed_shipping_method) { create(:shipping_method) } before do @@ -60,15 +64,16 @@ describe OrderSyncer do order.shipments.each(&:refresh_rates) # Updating the shipping method on a shipment updates the shipping method on the order, - # and vice-versa via logic in Spree's shipments controller. So updating both here mimics that - # behaviour. + # and vice-versa via logic in Spree's shipments controller. So updating both here mimics + # that behaviour. order.select_shipping_method(changed_shipping_method.id) subscription.assign_attributes(params) expect(syncer.sync!).to be true end - it "does not update the shipping_method on the subscription or on the pre-altered shipment" do + it "does not update the shipping_method on the subscription or " \ + "on the pre-altered shipment" do expect(order.reload.shipping_method).to eq changed_shipping_method expect(order.reload.shipments.first.shipping_method).to eq changed_shipping_method expect(syncer.order_update_issues[order.id]).to include "Shipping Method" @@ -105,7 +110,8 @@ describe OrderSyncer do context "when the payment method on a payment is not the same as the subscription" do let(:params) { { payment_method_id: new_payment_method.id } } - context "when the payment method on a payment is the same as the original payment method on the subscription" do + context "when the payment method on a payment is the same as the original payment method " \ + "on the subscription" do before do order.payments.first.update_attribute(:payment_method_id, new_payment_method.id) subscription.assign_attributes(params) @@ -120,7 +126,8 @@ describe OrderSyncer do end end - context "when the payment method on a shipment is not the same as the original payment method on the subscription" do + context "when the payment method on a shipment is not the same " \ + "as the original payment method on the subscription" do let(:changed_payment_method) { create(:payment_method) } before do @@ -422,7 +429,8 @@ describe OrderSyncer do end context "when order is complete" do - it "does not update the line_item quantities and adds the order to order_update_issues with insufficient stock" do + it "does not update the line_item quantities and adds the order " \ + "to order_update_issues with insufficient stock" do OrderWorkflow.new(order).complete expect(syncer.sync!).to be true @@ -432,18 +440,23 @@ describe OrderSyncer do expect(line_items.map(&:quantity)).to eq [1] expect(order.reload.total.to_f).to eq 59.97 line_item = order.line_items.find_by(variant_id: sli.variant_id) - expect(syncer.order_update_issues[order.id]).to include "#{line_item.product.name} - #{line_item.variant.full_name} - Insufficient stock available" + expect(syncer.order_update_issues[order.id]) + .to include "#{line_item.product.name} - #{line_item.variant.full_name} - " \ + "Insufficient stock available" end - it "does not update the line_item quantities and adds the order to order_update_issues with out of stock" do - # this single item available is used when the order is completed below, making the item out of stock + it "does not update the line_item quantities and adds the order " \ + "to order_update_issues with out of stock" do + # this single item available is used when the order is completed below, + # making the item out of stock variant.update_attribute(:on_hand, 1) OrderWorkflow.new(order).complete expect(syncer.sync!).to be true line_item = order.line_items.find_by(variant_id: sli.variant_id) - expect(syncer.order_update_issues[order.id]).to include "#{line_item.product.name} - #{line_item.variant.full_name} - Out of Stock" + expect(syncer.order_update_issues[order.id]) + .to include "#{line_item.product.name} - #{line_item.variant.full_name} - Out of Stock" end end end @@ -455,7 +468,8 @@ describe OrderSyncer do before { variant.update_attribute(:on_hand, 3) } - context "when the changed line_item quantity matches the new quantity on the subscription line item" do + context "when the changed line_item quantity matches the new quantity " \ + "on the subscription line item" do before do changed_line_item.update(quantity: 3) order.update_order! @@ -471,7 +485,8 @@ describe OrderSyncer do end end - context "when the changed line_item quantity doesn't match the new quantity on the subscription line item" do + context "when the changed line_item quantity doesn't match the new quantity " \ + "on the subscription line item" do before do changed_line_item.update(quantity: 2) order.update_order! @@ -485,7 +500,8 @@ describe OrderSyncer do expect(changed_line_item.reload.quantity).to eq 2 expect(order.reload.total.to_f).to eq 79.96 - expect(syncer.order_update_issues[order.id]).to include "#{changed_line_item.product.name} - #{changed_line_item.variant.full_name}" + expect(syncer.order_update_issues[order.id]) + .to include "#{changed_line_item.product.name} - #{changed_line_item.variant.full_name}" end end end @@ -540,10 +556,13 @@ describe OrderSyncer do line_items = Spree::LineItem.where(order_id: subscription.orders, variant_id: variant.id) expect(line_items.map(&:quantity)).to eq [] expect(order.reload.total.to_f).to eq 59.97 - expect(syncer.order_update_issues[order.id]).to include "#{variant.product.name} - #{variant.full_name} - Insufficient stock available" + expect(syncer.order_update_issues[order.id]) + .to include "#{variant.product.name} - #{variant.full_name} " \ + "- Insufficient stock available" end - context "and then updating the quantity of that subscription line item that was not added to the completed order" do + context "and then updating the quantity of that subscription line item " \ + "that was not added to the completed order" do it "does nothing to the order and adds the order to order_update_issues" do expect(syncer.sync!).to be true @@ -561,7 +580,8 @@ describe OrderSyncer do line_items = Spree::LineItem.where(order_id: subscription.orders, variant_id: variant.id) expect(line_items.map(&:quantity)).to eq [] - expect(syncer.order_update_issues[order.id]).to include "#{variant.product.name} - #{variant.full_name}" + expect(syncer.order_update_issues[order.id]) + .to include "#{variant.product.name} - #{variant.full_name}" end end end diff --git a/spec/services/paypal_items_builder_spec.rb b/spec/services/paypal_items_builder_spec.rb index a0c47af3c3..59c2312c6a 100644 --- a/spec/services/paypal_items_builder_spec.rb +++ b/spec/services/paypal_items_builder_spec.rb @@ -43,8 +43,9 @@ describe PaypalItemsBuilder do originator: included_tax_rate, included: true, state: "closed") } let!(:additional_tax_adjustment) { - create(:adjustment, label: "Additional Tax Adjustment", order: order, adjustable: order.shipment, - amount: 78, originator: additional_tax_rate, state: "closed") + create(:adjustment, label: "Additional Tax Adjustment", order: order, + adjustable: order.shipment, amount: 78, originator: additional_tax_rate, + state: "closed") } let!(:enterprise_fee) { create(:enterprise_fee) } let!(:line_item_enterprise_fee) { diff --git a/spec/services/permissions/order_spec.rb b/spec/services/permissions/order_spec.rb index ceebf77ff3..bd664d9140 100644 --- a/spec/services/permissions/order_spec.rb +++ b/spec/services/permissions/order_spec.rb @@ -104,7 +104,8 @@ module Permissions end end - context "as an enterprise that is a distributor in the order cycle, but not the distributor of the order" do + context "as an enterprise that is a distributor in the order cycle, " \ + "but not the distributor of the order" do before do allow(basic_permissions).to receive(:managed_enterprises) { Enterprise.where(id: random_enterprise) @@ -155,7 +156,8 @@ module Permissions end end - context "as the manager producer which has granted P-OC to the distributor of the parent order" do + context "as the manager producer which has granted P-OC to the distributor " \ + "of the parent order" do before do allow(basic_permissions).to receive(:managed_enterprises) { Enterprise.where(id: producer) @@ -174,7 +176,8 @@ module Permissions end end - context "as an enterprise that is a distributor in the order cycle, but not the distributor of the parent order" do + context "as an enterprise that is a distributor in the order cycle, " \ + "but not the distributor of the parent order" do before do allow(basic_permissions).to receive(:managed_enterprises) { Enterprise.where(id: random_enterprise) @@ -199,11 +202,13 @@ module Permissions allow(user).to receive(:has_spree_role?) { "admin" } end - it "only returns line items from completed, non-cancelled orders within search filter range" do + it "only returns line items from completed, " \ + "non-cancelled orders within search filter range" do expect(permissions.visible_line_items).to include order_completed.line_items.first expect(permissions.visible_line_items).to_not include order_cancelled.line_items.first expect(permissions.visible_line_items).to_not include order_cart.line_items.first - expect(permissions.visible_line_items).to_not include order_from_last_year.line_items.first + expect(permissions.visible_line_items) + .to_not include order_from_last_year.line_items.first end end end diff --git a/spec/services/permitted_attributes/order_cycle_spec.rb b/spec/services/permitted_attributes/order_cycle_spec.rb index 072ddb51cf..6990548af1 100644 --- a/spec/services/permitted_attributes/order_cycle_spec.rb +++ b/spec/services/permitted_attributes/order_cycle_spec.rb @@ -21,8 +21,17 @@ module PermittedAttributes describe "nested incoming_exchanges attributes" do let(:params) { - ActionController::Parameters.new(order_cycle: { incoming_exchanges: [{ sender_id: "2", - name: "Exchange Name", variants: [] }] } ) + ActionController::Parameters.new( + order_cycle: { + incoming_exchanges: [ + { + sender_id: "2", + name: "Exchange Name", + variants: [] + } + ] + } + ) } it "keeps permitted and removes not permitted" do @@ -36,8 +45,18 @@ module PermittedAttributes describe "variants inside incoming_exchanges attributes" do let(:params) { - ActionController::Parameters.new(order_cycle: { incoming_exchanges: [{ variants: { "7" => true, - "12" => true } }] } ) + ActionController::Parameters.new( + order_cycle: { + incoming_exchanges: [ + { + variants: { + "7" => true, + "12" => true, + } + } + ] + } + ) } it "keeps all variant_ids provided" do diff --git a/spec/services/product_tag_rules_filterer_spec.rb b/spec/services/product_tag_rules_filterer_spec.rb index 1624f9b09b..0c25c0b995 100644 --- a/spec/services/product_tag_rules_filterer_spec.rb +++ b/spec/services/product_tag_rules_filterer_spec.rb @@ -82,8 +82,8 @@ describe ProductTagRulesFilterer do variant_hidden_by_default.update_attribute(:tag_list, default_hide_rule.preferred_variant_tags) variant_hidden_by_rule.update_attribute(:tag_list, hide_rule.preferred_variant_tags) - variant_hidden_for_another_customer.update_attribute(:tag_list, - non_applicable_rule.preferred_variant_tags) + variant_hidden_for_another_customer + .update_attribute(:tag_list, non_applicable_rule.preferred_variant_tags) overrides_to_hide = filterer.__send__(:overrides_to_hide) expect(overrides_to_hide).to include variant_hidden_by_default.id, diff --git a/spec/services/products_renderer_spec.rb b/spec/services/products_renderer_spec.rb index 2a1e0b17ab..3dc0fde48a 100644 --- a/spec/services/products_renderer_spec.rb +++ b/spec/services/products_renderer_spec.rb @@ -67,9 +67,12 @@ describe ProductsRenderer do end context "filtering" do - it "filters products by name_or_meta_keywords_or_variants_display_as_or_variants_display_name_or_supplier_name_cont" do + it "filters products by name_or_meta_keywords_or_variants_display_as_or_" \ + "variants_display_name_or_supplier_name_cont" do products_renderer = ProductsRenderer.new(distributor, order_cycle, customer, { q: { - name_or_meta_keywords_or_variants_display_as_or_variants_display_name_or_supplier_name_cont: "apples" + "#{[:name, :meta_keywords, :variants_display_as, + :variants_display_name, :supplier_name] + .join('_or_')}_cont": "apples", } }) products = products_renderer.send(:products) expect(products).to eq([product_apples]) @@ -200,7 +203,7 @@ describe ProductsRenderer do allow(hub).to receive(:prefers_product_selection_from_inventory_only?) { true } end - it "does not render variants that have not been explicitly added to the inventory for the hub" do + it "doesn't render variants that haven't been explicitly added to inventory for the hub" do # but does render 'new' variants, ie. v1 expect(variants[p.id]).to include v3 expect(variants[p.id]).to_not include v1, v4 diff --git a/spec/support/cancan_helper.rb b/spec/support/cancan_helper.rb index 1acba887c3..11b7723db2 100644 --- a/spec/support/cancan_helper.rb +++ b/spec/support/cancan_helper.rb @@ -10,7 +10,8 @@ module Spree ability = Ability.new(user) target = options[:for] @ability_result = {} - ability_hash = { ability_hash => true } if ability_hash.is_a? Symbol # e.g.: :create => {:create => true} + # e.g.: :create => {:create => true} + ability_hash = { ability_hash => true } if ability_hash.is_a? Symbol if ability_hash.is_a? Array ability_hash = ability_hash.inject({}){ |member, i| member.merge(i => true) @@ -32,7 +33,8 @@ module Spree } end target = options[:for] - message = "expected User:#{user} to have ability: #{ability_hash} for #{target}, but actual result is #{@ability_result}" + message = "expected User:#{user} to have ability: #{ability_hash} for #{target}, " \ + "but actual result is #{@ability_result}" end # to clean up output of RSpec Documentation format diff --git a/spec/support/features/datepicker_helper.rb b/spec/support/features/datepicker_helper.rb index b1894d8b5f..3840670f54 100644 --- a/spec/support/features/datepicker_helper.rb +++ b/spec/support/features/datepicker_helper.rb @@ -50,8 +50,10 @@ module Features end def datepicker_month_and_year - month = find(".flatpickr-calendar.open .flatpickr-current-month select.flatpickr-monthDropdown-months").value.to_i + 1 - year = find(".flatpickr-calendar.open .flatpickr-current-month .numInputWrapper .cur-year").value + month = find(".flatpickr-calendar.open .flatpickr-current-month " \ + "select.flatpickr-monthDropdown-months").value.to_i + 1 + year = find(".flatpickr-calendar.open .flatpickr-current-month " \ + ".numInputWrapper .cur-year").value month.to_s + " " + year.to_s end diff --git a/spec/support/matchers/select2_matchers.rb b/spec/support/matchers/select2_matchers.rb index 117b67aacc..93d176958d 100644 --- a/spec/support/matchers/select2_matchers.rb +++ b/spec/support/matchers/select2_matchers.rb @@ -52,7 +52,8 @@ RSpec::Matchers.define :have_select2 do |id, options = {}| if results.none? && (options.key? :with_options) results << all_options_absent(from, options[:with_options]) # results << exact_options_present(from, options[:options]) if options.key? :options - # results << no_options_present(from, options[:without_options]) if options.key? :without_options + # results << no_options_present(from, options[:without_options]) + # if options.key? :without_options end if (options.keys & %i(selected options without_options)).any? diff --git a/spec/support/request/web_helper.rb b/spec/support/request/web_helper.rb index 92d7333de2..c4ebf00118 100644 --- a/spec/support/request/web_helper.rb +++ b/spec/support/request/web_helper.rb @@ -58,20 +58,22 @@ module WebHelper if options[:search] page.find(:xpath, '//body') - .find(:css, '.select2-drop-active input.select2-input, .select2-dropdown-open input.select2-input') + .find(:css, '.select2-drop-active input.select2-input, ' \ + '.select2-dropdown-open input.select2-input') .set(value) end page.find(:xpath, '//body') - .find(:css, '.select2-drop-active .select2-result-label', text: options[:select_text] || value) + .find(:css, '.select2-drop-active .select2-result-label', + text: options[:select_text] || value) .click expect(page).to have_select2 options[:from], selected: options[:select_text] || value end def open_select2(selector) - page.find(selector).scroll_to(page.find(selector)).find(:css, - '.select2-choice, .select2-search-field').click + page.find(selector).scroll_to(page.find(selector)) + .find(:css, '.select2-choice, .select2-search-field').click end def close_select2 diff --git a/spec/system/admin/adjustments_spec.rb b/spec/system/admin/adjustments_spec.rb index f1a181561f..b47d8b572d 100644 --- a/spec/system/admin/adjustments_spec.rb +++ b/spec/system/admin/adjustments_spec.rb @@ -15,7 +15,8 @@ describe ' let!(:order) { create(:order_with_totals_and_distribution, user: user, distributor: distributor, - order_cycle: order_cycle, state: 'complete', payment_state: 'balance_due') + order_cycle: order_cycle, state: 'complete', + payment_state: 'balance_due') } let!(:tax_category) { create(:tax_category, name: 'GST') } let!(:tax_rate) { diff --git a/spec/system/admin/bulk_order_management_spec.rb b/spec/system/admin/bulk_order_management_spec.rb index ce2921bf9a..03587f4b25 100644 --- a/spec/system/admin/bulk_order_management_spec.rb +++ b/spec/system/admin/bulk_order_management_spec.rb @@ -70,9 +70,13 @@ describe ' it "orders by completion date" do find("a", text: 'COMPLETED AT').click # sets ascending ordering - expect(page).to have_content(/#{li2.product.name}.*#{li1.product.name}.*#{li22.product.name}.*#{li21.product.name}/m) + expect(page).to have_content( + /#{li2.product.name}.*#{li1.product.name}.*#{li22.product.name}.*#{li21.product.name}/m + ) find("a", text: 'COMPLETED AT').click # sets descending ordering - expect(page).to have_content(/#{li21.product.name}.*#{li22.product.name}.*#{li1.product.name}.*#{li2.product.name}/m) + expect(page).to have_content( + /#{li21.product.name}.*#{li22.product.name}.*#{li1.product.name}.*#{li2.product.name}/m + ) end end @@ -123,11 +127,11 @@ describe ' expect(page).to have_button("Next", disabled: false) expect(page).to have_button("Last »", disabled: false) within "tbody" do - expect(page).to have_css("tr", count: 15) # verifies that the remaining 15 line items are shown + expect(page).to have_css("tr", count: 15) # verifies the remaining 15 line items are shown end click_button "2" # switches to the second results page within "tbody" do - expect(page).to have_css("tr", count: 5) # verifies that the remaining 5 line items are shown + expect(page).to have_css("tr", count: 5) # verifies the remaining 5 line items are shown end click_button "1" # switches to the first results page select2_select "50 per page", from: "autogen4" # should display all 20 line items @@ -240,11 +244,13 @@ describe ' context "displaying individual columns" 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, bill_address: create(:address) ) } 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, bill_address: nil ) } let!(:li1) { create(:line_item_with_shipment, order: o1) } @@ -258,7 +264,8 @@ describe ' it "displays a column for user's full name" do expect(page).to have_selector "th.full_name", text: "NAME" - expect(page).to have_selector "td.full_name", text: "#{o1.bill_address.last_name}, #{o1.bill_address.first_name}" + expect(page).to have_selector "td.full_name", + text: "#{o1.bill_address.last_name}, #{o1.bill_address.first_name}" expect(page).to have_selector "td.full_name", text: "" end @@ -275,7 +282,8 @@ describe ' expect(page).to have_selector "td.producer", text: li2.product.supplier.name end - it "displays a column for variant description, which shows only product name when options text is blank" do + it "displays a column for variant description, which shows only product name " \ + "when options text is blank" do expect(page).to have_selector "th.variant", text: "PRODUCT: UNIT" expect(page).to have_selector "td.variant", text: li1.product.name expect(page).to have_selector "td.variant", @@ -437,8 +445,8 @@ describe ' 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 ) + create(:line_item_with_shipment, order: o1, variant: v1, quantity: 5, + final_weight_volume: 1000, price: 10.00 ) } before :each do @@ -524,7 +532,8 @@ describe ' let!(:s1) { create(:supplier_enterprise) } let!(:s2) { create(:supplier_enterprise) } 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, order_cycle: create(:simple_order_cycle) ) } let!(:li1) { @@ -538,7 +547,7 @@ describe ' visit_bulk_order_management end - it "displays a select box for producers, which filters line items by the selected supplier" do + it "displays select box for producers, which filters line items by the selected supplier" do expect(page).to have_selector "tr#li_#{li1.id}" expect(page).to have_selector "tr#li_#{li2.id}" open_select2 "#s2id_supplier_filter" @@ -571,11 +580,13 @@ describe ' let!(:d1) { create(:distributor_enterprise) } let!(:d2) { create(:distributor_enterprise) } let!(:o1) { - create(:order_with_distributor, state: 'complete', shipment_state: 'ready', completed_at: Time.zone.now, distributor: d1, + create(:order_with_distributor, state: 'complete', shipment_state: 'ready', + completed_at: Time.zone.now, distributor: d1, order_cycle: create(:simple_order_cycle) ) } let!(:o2) { - create(:order_with_distributor, state: 'complete', shipment_state: 'ready', completed_at: Time.zone.now, distributor: d2, + create(:order_with_distributor, state: 'complete', shipment_state: 'ready', + completed_at: Time.zone.now, distributor: d2, order_cycle: create(:simple_order_cycle) ) } let!(:li1) { create(:line_item_with_shipment, order: o1 ) } @@ -585,7 +596,7 @@ describe ' visit_bulk_order_management end - it "displays a select box for distributors, which filters line items "\ + it "displays a select box for distributors, which filters line items " \ "by the selected distributor", retry: 3 do expect(page).to have_selector "tr#li_#{li1.id}" expect(page).to have_selector "tr#li_#{li2.id}" @@ -622,19 +633,23 @@ describe ' let!(:oc2) { create(:simple_order_cycle, distributors: [distributor]) } let!(:oc3) { create(:simple_order_cycle, distributors: [distributor]) } 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, order_cycle: oc1 ) } 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, order_cycle: oc2 ) } let!(:o3) { - create(:order_with_distributor, state: 'complete', shipment_state: 'ready', completed_at: Time.zone.now + 1.week, + create(:order_with_distributor, state: 'complete', shipment_state: 'ready', + completed_at: Time.zone.now + 1.week, order_cycle: oc3 ) } let!(:o4) { - create(:order_with_distributor, state: 'complete', shipment_state: 'ready', completed_at: Time.zone.now + 2.weeks, + create(:order_with_distributor, state: 'complete', shipment_state: 'ready', + completed_at: Time.zone.now + 2.weeks, order_cycle: oc3 ) } let!(:li1) { create(:line_item_with_shipment, order: o1 ) } @@ -648,7 +663,7 @@ describe ' visit_bulk_order_management end - it "displays a select box for order cycles, which filters line items "\ + it "displays a select box for order cycles, which filters line items " \ "by the selected order cycle", retry: 3 do displays_default_orders expect(page).to have_select2 'order_cycle_filter', @@ -682,11 +697,13 @@ describe ' let!(:p1) { create(:product, supplier: s1) } let!(:p2) { create(:product, supplier: s2) } let!(:o1) { - create(:order_with_distributor, state: 'complete', shipment_state: 'ready', completed_at: Time.zone.now, distributor: d1, + create(:order_with_distributor, state: 'complete', shipment_state: 'ready', + completed_at: Time.zone.now, distributor: d1, order_cycle: oc1 ) } let!(:o2) { - create(:order_with_distributor, state: 'complete', shipment_state: 'ready', completed_at: Time.zone.now, distributor: d2, + create(:order_with_distributor, state: 'complete', shipment_state: 'ready', + completed_at: Time.zone.now, distributor: d2, order_cycle: oc2 ) } let!(:li1) { create(:line_item_with_shipment, order: o1, product: p1 ) } @@ -810,7 +827,8 @@ describe ' page.find('.filter-actions .button.icon-search').click end # daterange picker should have changed - expect(find("input.datepicker").value).to eq "#{today.prev_day(9).strftime('%F')} to #{today.strftime('%F')}" + expect(find("input.datepicker").value) + .to eq "#{today.prev_day(9).strftime('%F')} to #{today.strftime('%F')}" expect(page).to have_no_selector "#save-bar" within("tr#li_#{li2.id} td.quantity") do expect(page).to have_no_selector "input[name=quantity].ng-dirty" @@ -877,7 +895,8 @@ describe ' context "performing actions" do context "deletes selected items" do - it "displays a confirmation dialog when deleting one or more items leads to order cancelation" do + it "displays a confirmation dialog when deleting one or more items " \ + "leads to order cancelation" do expect(page).to have_selector "tr#li_#{li1.id}" expect(page).to have_selector "tr#li_#{li11.id}" within("tr#li_#{li1.id} td.bulk") do @@ -890,7 +909,8 @@ describe ' find("div#bulk-actions-dropdown").click find("div#bulk-actions-dropdown div.menu_item", text: "Delete Selected" ).click - expect(page).to have_content "This operation will result in one or more empty orders, which will be cancelled. Do you wish to proceed?" + expect(page).to have_content "This operation will result in one or more empty " \ + "orders, which will be cancelled. Do you wish to proceed?" expect do within(".modal") do @@ -907,7 +927,8 @@ describe ' end.to have_enqueued_mail(Spree::OrderMailer, :cancel_email) end - it "deletes one line item should show modal confirmation about this line item deletion and not about order cancelation" do + it "deletes one line item should show modal confirmation about this line item deletion " \ + "and not about order cancelation" do expect(page).to have_selector "tr#li_#{li1.id}" within("tr#li_#{li1.id} td.bulk") do check "bulk" @@ -917,7 +938,8 @@ describe ' find("div#bulk-actions-dropdown div.menu_item", text: "Delete Selected" ).click within ".modal" do - expect(page).to have_content "This will delete one line item from the order. Are you sure you want to proceed?" + expect(page).to have_content "This will delete one line item from the order. " \ + "Are you sure you want to proceed?" click_on "OK" end @@ -934,12 +956,12 @@ describe ' context "using edit buttons" do let(:address) { create(:address) } let!(:o1) { - create(:order_with_distributor, ship_address: address, state: 'complete', shipment_state: 'ready', - completed_at: Time.zone.now ) + create(:order_with_distributor, ship_address: address, state: 'complete', + shipment_state: 'ready', completed_at: Time.zone.now ) } let!(:o2) { - create(:order_with_distributor, ship_address: address, state: 'complete', shipment_state: 'ready', - completed_at: Time.zone.now ) + create(:order_with_distributor, ship_address: address, 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 ) } @@ -951,12 +973,14 @@ describe ' visit_bulk_order_management end - it "shows an edit button for line_items, which takes the user to the standard edit page for the order" do + it "shows an edit button for line_items, which takes the user " \ + "to the standard edit page for the order" do expect(page).to have_selector "a.edit-order", count: 2 # Shows a confirm dialog when unsaved changes exist - page.driver.dismiss_modal :confirm, - text: "Unsaved changes exist and will be lost if you continue." do + page.driver + .dismiss_modal :confirm, + text: "Unsaved changes exist and will be lost if you continue." do within "tr#li_#{li1.id}" do fill_in "quantity", with: (li1.quantity + 1) find("a.edit-order").click @@ -1003,7 +1027,8 @@ describe ' end end - context "when deleting the last item of an order, it shows a modal about order cancellation" do + context "when deleting the last item of an order, " \ + "it shows a modal about order cancellation" do before :each do visit_bulk_order_management expect(page).to have_selector "a.delete-line-item", count: 2 @@ -1174,12 +1199,12 @@ describe ' let(:d1) { create(:distributor_enterprise, name: 'First Distributor') } let(:d2) { create(:distributor_enterprise, name: 'Another Distributor') } let!(:o1) { - create(:order_with_distributor, state: 'complete', shipment_state: 'ready', completed_at: Time.zone.now, - distributor: d1 ) + create(:order_with_distributor, state: 'complete', shipment_state: 'ready', + completed_at: Time.zone.now, distributor: d1 ) } let!(:o2) { - create(:order_with_distributor, state: 'complete', shipment_state: 'ready', completed_at: Time.zone.now, - distributor: d2 ) + create(:order_with_distributor, state: 'complete', shipment_state: 'ready', + completed_at: Time.zone.now, distributor: d2 ) } let!(:line_item_distributed) { create(:line_item_with_shipment, order: o1, product: create(:product, supplier: s1) ) diff --git a/spec/system/admin/bulk_product_update_spec.rb b/spec/system/admin/bulk_product_update_spec.rb index 565a74ef49..a2876661e7 100644 --- a/spec/system/admin/bulk_product_update_spec.rb +++ b/spec/system/admin/bulk_product_update_spec.rb @@ -151,9 +151,11 @@ describe ' p1 = FactoryBot.create(:product, price: 2.0, variant_unit: "weight", variant_unit_scale: "1000") v1 = FactoryBot.create(:variant, product: p1, price: 12.75, - unit_value: 1200, unit_description: "(small bag)", display_as: "bag") + unit_value: 1200, unit_description: "(small bag)", + display_as: "bag") v2 = FactoryBot.create(:variant, product: p1, price: 2.50, - unit_value: 4800, unit_description: "(large bag)", display_as: "bin") + unit_value: 4800, unit_description: "(large bag)", + display_as: "bin") visit spree.admin_products_path expect(page).to have_selector "a.view-variants", count: 1 @@ -304,7 +306,8 @@ describe ' end click_button 'Save Changes', match: :first - expect(page.find("#status-message")).to have_content "Unit value can't be blank Unit value is not a number" + expect(page.find("#status-message")) + .to have_content "Unit value can't be blank Unit value is not a number" end it "creating a variant with unit value is: '120g' and 'on_demand' checked" do @@ -319,7 +322,8 @@ describe ' end click_button 'Save Changes', match: :first - expect(page.find("#status-message")).to have_content "Unit value can't be blank Unit value is not a number" + expect(page.find("#status-message")) + .to have_content "Unit value can't be blank Unit value is not a number" end end end @@ -329,8 +333,8 @@ describe ' s2 = FactoryBot.create(:supplier_enterprise) t1 = FactoryBot.create(:taxon) t2 = FactoryBot.create(:taxon) - p = FactoryBot.create(:product, supplier: s1, - variant_unit: 'volume', variant_unit_scale: 1, primary_taxon: t2, sku: "OLD SKU") + p = FactoryBot.create(:product, supplier: s1, variant_unit: 'volume', + variant_unit_scale: 1, primary_taxon: t2, sku: "OLD SKU") login_as_admin visit spree.admin_products_path @@ -597,7 +601,7 @@ describe ' visit spree.admin_products_path end - it "shows an edit button for products, which takes the user to the standard edit page for that product" do + it "shows edit product button, which takes user to the standard edit page of that product" do expect(page).to have_selector "a.edit-product", count: 2 within "tr#p_#{p1.id}" do @@ -607,7 +611,8 @@ describe ' expect(URI.parse(current_url).path).to eq spree.edit_admin_product_path(v1.product.id) end - it "shows an edit button for products, which takes the user to the standard edit page for that product, url includes selected filter" do + it "shows edit product button, which takes user to the standard edit page " \ + "for that product, url includes selected filter" do expect(page).to have_selector "a.edit-product", count: 2 # Set a filter @@ -624,7 +629,7 @@ describe ' ) end - it "shows an edit button for variants, which takes the user to the standard edit page for that variant" do + it "shows edit variant button, which takes user to the standard edit page for it" do expect(page).to have_selector "a.view-variants" all("a.view-variants").each(&:click) @@ -640,7 +645,8 @@ describe ' ) end - it "shows an edit button for variants, which takes the user to the standard edit page for that variant, url includes selected filter" do + it "shows edit variant button, which takes the user to the standard edit page " \ + "for that variant, url includes selected filter" do expect(page).to have_selector "a.view-variants" all("a.view-variants").each(&:click) @@ -662,7 +668,7 @@ describe ' end describe "using clone buttons" do - it "shows a clone button for products, which duplicates the product and adds it to the page when clicked" do + it "shows clone product button, which dupes it & adds it to the page when clicked" do p1 = FactoryBot.create(:product, name: "P1") p2 = FactoryBot.create(:product, name: "P2") p3 = FactoryBot.create(:product, name: "P3") @@ -787,8 +793,12 @@ describe ' it "shows only suppliers that I manage or have permission to" do visit spree.admin_products_path - expect(page).to have_select 'producer_id', - with_options: [supplier_managed1.name, supplier_managed2.name, supplier_permitted.name], selected: supplier_managed1.name + expect(page) + .to have_select( + 'producer_id', + with_options: [supplier_managed1.name, supplier_managed2.name, supplier_permitted.name], + selected: supplier_managed1.name, + ) expect(page).to have_no_select 'producer_id', with_options: [supplier_unmanaged.name] end diff --git a/spec/system/admin/configuration/content_spec.rb b/spec/system/admin/configuration/content_spec.rb index 5633d51d10..aaf4d4ec2e 100644 --- a/spec/system/admin/configuration/content_spec.rb +++ b/spec/system/admin/configuration/content_spec.rb @@ -19,8 +19,8 @@ describe " it "fills in a setting shows the result on the home page" do fill_in "footer_facebook_url", with: "" fill_in "footer_twitter_url", with: "http://twitter.com/me" - fill_in "footer_links_md", with: "[markdown link](/:/?#@!$&'()*+,;=0123456789"\ - "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ)" + fill_in "footer_links_md", with: "[markdown link](/:/?#@!$&'()*+,;=0123456789" \ + "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ)" click_button "Update" expect(page).to have_content "Your content has been successfully updated!" diff --git a/spec/system/admin/customers_spec.rb b/spec/system/admin/customers_spec.rb index 3a7a7d8e47..59b5b16a86 100644 --- a/spec/system/admin/customers_spec.rb +++ b/spec/system/admin/customers_spec.rb @@ -97,8 +97,8 @@ code: nil, created_manually: true) end end expect(page).to have_selector "#info-dialog .text", - text: 'Delete failed: This customer has '\ - 'active subscriptions. Cancel them first.' + text: 'Delete failed: This customer has ' \ + 'active subscriptions. Cancel them first.' click_button "OK" }.to_not change{ Customer.count } diff --git a/spec/system/admin/enterprises/index_spec.rb b/spec/system/admin/enterprises/index_spec.rb index 831254fa9a..f1d78745ec 100644 --- a/spec/system/admin/enterprises/index_spec.rb +++ b/spec/system/admin/enterprises/index_spec.rb @@ -155,7 +155,7 @@ describe 'Enterprises Index' do expect(find('.js-admin-section-header')).to have_link "New Enterprise" end - it "does not give me an option to change or update the package and "\ + it "does not give me an option to change or update the package and " \ "producer properties of enterprises I manage" do visit admin_enterprises_path @@ -186,7 +186,7 @@ describe 'Enterprises Index' do end context "listing enterprises" do - it "allows me to change or update the package and "\ + it "allows me to change or update the package and " \ "producer properties of enterprises I manage" do visit admin_enterprises_path diff --git a/spec/system/admin/enterprises_spec.rb b/spec/system/admin/enterprises_spec.rb index b179223557..f88a200f29 100644 --- a/spec/system/admin/enterprises_spec.rb +++ b/spec/system/admin/enterprises_spec.rb @@ -401,7 +401,7 @@ describe ' # Then it should show me an error expect(page).to have_no_content 'Enterprise "zzz" has been successfully created!' - expect(page).to have_content "#{enterprise_user.email} is not permitted "\ + expect(page).to have_content "#{enterprise_user.email} is not permitted " \ "to own any more enterprises (limit is 1)." end end @@ -438,7 +438,7 @@ describe ' expect(distributor3.reload.name).to eq('Eaterprises') end - it "does not show links to manage shipping methods, payment methods or "\ + it "does not show links to manage shipping methods, payment methods or " \ "enterprise fees on the edit page" do visit admin_enterprises_path within("tbody#e_#{distributor3.id}") { click_link 'Settings' } diff --git a/spec/system/admin/order_cycles/list_spec.rb b/spec/system/admin/order_cycles/list_spec.rb index fd13b74c68..bf91063bbe 100644 --- a/spec/system/admin/order_cycles/list_spec.rb +++ b/spec/system/admin/order_cycles/list_spec.rb @@ -162,7 +162,7 @@ match: :first).value).to eq oc_open_at.strftime("%Y-%m-13 %H:%M") end end - it "correctly opens the datetimepicker and closes it using the last button "\ + it "correctly opens the datetimepicker and closes it using the last button " \ "(the 'Close' one)" do login_as_admin visit admin_order_cycles_path @@ -205,8 +205,8 @@ match: :first).value).to eq test_value.to_datetime.strftime("%Y-%m-%d %H:%M") end def date_warning_msg(nbr = 1) - "This order cycle is linked to %d open subscription orders. Changing this date now will not "\ - "affect any orders which have already been placed, but should be avoided if possible. "\ + "This order cycle is linked to %d open subscription orders. Changing this date now will not " \ + "affect any orders which have already been placed, but should be avoided if possible. " \ "Are you sure you want to proceed?" % nbr end end diff --git a/spec/system/admin/order_cycles/simple_spec.rb b/spec/system/admin/order_cycles/simple_spec.rb index 5718114c80..de1938f32b 100644 --- a/spec/system/admin/order_cycles/simple_spec.rb +++ b/spec/system/admin/order_cycles/simple_spec.rb @@ -97,8 +97,8 @@ describe ' it "displays a warning on the dashboard" do login_to_admin_section expect(page).to have_content( - "The hub #{hub.name} is listed in an active order cycle, but does not have valid "\ - "shipping and payment methods. Until you set these up, customers will not be able "\ + "The hub #{hub.name} is listed in an active order cycle, but does not have valid " \ + "shipping and payment methods. Until you set these up, customers will not be able " \ "to shop at this hub." ) end @@ -107,8 +107,8 @@ describe ' login_as_admin visit admin_order_cycles_path expect(page).to have_content( - "The hub #{hub.name} is listed in an active order cycle, "\ - "but does not have valid shipping and payment methods. Until you set these up, "\ + "The hub #{hub.name} is listed in an active order cycle, " \ + "but does not have valid shipping and payment methods. Until you set these up, " \ "customers will not be able to shop at this hub." ) end @@ -751,7 +751,7 @@ describe ' end end - it "modify the minute of a order cycle with the keyboard, "\ + it "modify the minute of a order cycle with the keyboard, " \ "check that the modifications are taken into account" do order_cycle = create(:simple_order_cycle, name: "Translusent Berries") login_as_admin diff --git a/spec/system/admin/order_spec.rb b/spec/system/admin/order_spec.rb index e608b7ca19..b4d8a92273 100644 --- a/spec/system/admin/order_spec.rb +++ b/spec/system/admin/order_spec.rb @@ -735,7 +735,7 @@ distributors: [distributor1]) end end - context "when the distributor unsupport a shipping method that's selected "\ + context "when the distributor unsupport a shipping method that's selected " \ "in an existing order " do before do distributor1.shipping_methods = [shipping_method_for_distributor1, diff --git a/spec/system/admin/orders_spec.rb b/spec/system/admin/orders_spec.rb index e2dfbd7c73..e64cd0b5de 100644 --- a/spec/system/admin/orders_spec.rb +++ b/spec/system/admin/orders_spec.rb @@ -531,7 +531,7 @@ distributors: [distributor4, distributor5]) } page.find("span", text: "Send Invoices").click end - expect(page).to have_content "This will email customer invoices "\ + expect(page).to have_content "This will email customer invoices " \ "for all selected complete orders." expect(page).to have_content "Are you sure you want to proceed?" @@ -576,7 +576,7 @@ distributors: [distributor4, distributor5]) } end expect(page).to have_content "Compiling Invoices" - expect(page).to have_content "Please wait until the PDF is ready "\ + expect(page).to have_content "Please wait until the PDF is ready " \ "before closing this modal." # an error 422 is generated in the console end diff --git a/spec/system/admin/overview_spec.rb b/spec/system/admin/overview_spec.rb index 32fd58050c..c457bc56c0 100644 --- a/spec/system/admin/overview_spec.rb +++ b/spec/system/admin/overview_spec.rb @@ -40,8 +40,8 @@ describe ' it "displays a message telling how to set visibility" do visit '/admin' expect(page).to have_selector ".alert-box", - text: "To allow people to find you, turn on your "\ - "visibility under Manage #{d1.name}." + text: "To allow people to find you, turn on your " \ + "visibility under Manage #{d1.name}." end end diff --git a/spec/system/admin/payment_method_spec.rb b/spec/system/admin/payment_method_spec.rb index e6de2bca7e..ef2611ac49 100644 --- a/spec/system/admin/payment_method_spec.rb +++ b/spec/system/admin/payment_method_spec.rb @@ -80,8 +80,8 @@ describe ' select2_select "Revoked", from: "payment_method_preferred_enterprise_id" expect(page).to have_selector "#stripe-account-status .alert-box.error", - text: 'Access to this Stripe account has been revoked, '\ - 'please reconnect your account.' + text: 'Access to this Stripe account has been revoked, ' \ + 'please reconnect your account.' select2_select "Connected", from: "payment_method_preferred_enterprise_id" expect(page).to have_selector "#stripe-account-status .status", text: "Status: Connected" diff --git a/spec/system/admin/product_import_spec.rb b/spec/system/admin/product_import_spec.rb index 3242a24c3b..f0e423fd87 100644 --- a/spec/system/admin/product_import_spec.rb +++ b/spec/system/admin/product_import_spec.rb @@ -60,7 +60,7 @@ describe "Product Import" do end after { File.delete('/tmp/test.csv') } - it "validates entries and saves them if they are all valid and allows viewing new items "\ + it "validates entries and saves them if they are all valid and allows viewing new items " \ "in Bulk Products" do csv_data = CSV.generate do |csv| csv << ["name", "producer", "category", "on_hand", "price", "units", "unit_type", @@ -156,7 +156,7 @@ describe "Product Import" do proceed_to_validation find('div.header-description', text: 'Items contain errors').click - expect(page).to have_content "Variant_unit_name must be the same for products "\ + expect(page).to have_content "Variant_unit_name must be the same for products " \ "with the same name" expect(page).to have_content "Imported file contains invalid entries" @@ -272,7 +272,7 @@ describe "Product Import" do expect(Spree::Product.find_by(name: 'Beans').on_hand).to eq 0 end - it "can save a new product and variant of that product at the same time, "\ + it "can save a new product and variant of that product at the same time, " \ "add variant to existing product" do csv_data = CSV.generate do |csv| csv << ["name", "producer", "category", "on_hand", "price", "units", "unit_type", @@ -445,11 +445,11 @@ describe "Product Import" do expect(page).to have_content "Aubergine" expect(page).to have_select( - "variant-overrides-#{Spree::Product.find_by(name: 'Aubergine').variants.first.id}"\ + "variant-overrides-#{Spree::Product.find_by(name: 'Aubergine').variants.first.id}" \ "-on_demand", selected: "Yes" ) expect(page).to have_input( - "variant-overrides-#{Spree::Product.find_by(name: 'Aubergine').variants.first.id}"\ + "variant-overrides-#{Spree::Product.find_by(name: 'Aubergine').variants.first.id}" \ "-price", with: "3.3" ) end @@ -472,7 +472,7 @@ describe "Product Import" do proceed_to_validation find('div.header-description', text: 'Items contain errors').click - expect(page).to have_content "Variant_unit_name must be the same for products "\ + expect(page).to have_content "Variant_unit_name must be the same for products " \ "with the same name" expect(page).to have_content "Imported file contains invalid entries" expect(page).to have_no_selector 'input[type=submit][value="Save"]' @@ -861,7 +861,7 @@ describe "Product Import" do it "handles cases where files contain malformed data" do csv_data = "name,producer,category,on_hand,price,units,unit_type,shipping_category\n" - csv_data += "Malformed \rBrocolli,#{enterprise.name},Vegetables,8,2.50,200,g,"\ + csv_data += "Malformed \rBrocolli,#{enterprise.name},Vegetables,8,2.50,200,g," \ "#{shipping_category.name}\n" File.write('/tmp/test.csv', csv_data) diff --git a/spec/system/admin/subscriptions_spec.rb b/spec/system/admin/subscriptions_spec.rb index ffd4257cf0..c809abbb8b 100644 --- a/spec/system/admin/subscriptions_spec.rb +++ b/spec/system/admin/subscriptions_spec.rb @@ -593,10 +593,11 @@ describe 'Subscriptions' do expect(page).to have_content 'Saved' expect(page).to have_selector "#order_update_issues_dialog .message", - text: 'Some orders could not be automatically updated, '\ - 'this is most likely because they have been manually '\ - 'edited. Please review the issues listed below and make '\ - 'any adjustments to individual orders if required.' + text: 'Some orders could not be automatically updated, ' \ + 'this is most likely because they have been ' \ + 'manually edited. Please review the issues listed ' \ + 'below and make any adjustments to individual ' \ + 'orders if required.' end end end diff --git a/spec/system/admin/tag_rules_spec.rb b/spec/system/admin/tag_rules_spec.rb index 4b72719bae..788911f41e 100644 --- a/spec/system/admin/tag_rules_spec.rb +++ b/spec/system/admin/tag_rules_spec.rb @@ -28,8 +28,8 @@ describe 'Tag Rules' do within(".customer_tag #tr_0") do fill_in_tag "volunteers-only" select2_select "NOT VISIBLE", - from: "enterprise_tag_rules_attributes_0_preferred_matched_"\ - "shipping_methods_visibility" + from: "enterprise_tag_rules_attributes_0_preferred_matched_" \ + "shipping_methods_visibility" end # New FilterProducts Rule @@ -39,8 +39,8 @@ describe 'Tag Rules' do within(".customer_tag #tr_1") do fill_in_tag "volunteers-only1" select2_select "VISIBLE", - from: "enterprise_tag_rules_attributes_1_preferred_matched_"\ - "variants_visibility" + from: "enterprise_tag_rules_attributes_1_preferred_matched_" \ + "variants_visibility" end # New FilterPaymentMethods Rule @@ -50,8 +50,8 @@ describe 'Tag Rules' do within(".customer_tag #tr_2") do fill_in_tag "volunteers-only2" select2_select "VISIBLE", - from: "enterprise_tag_rules_attributes_2_preferred_matched_"\ - "payment_methods_visibility" + from: "enterprise_tag_rules_attributes_2_preferred_matched_" \ + "payment_methods_visibility" end # New FilterOrderCycles Rule @@ -61,8 +61,8 @@ describe 'Tag Rules' do within(".customer_tag #tr_3") do fill_in_tag "volunteers-only3" select2_select "NOT VISIBLE", - from: "enterprise_tag_rules_attributes_3_preferred_matched_"\ - "order_cycles_visibility" + from: "enterprise_tag_rules_attributes_3_preferred_matched_" \ + "order_cycles_visibility" end # New DEFAULT FilterOrderCycles Rule @@ -167,10 +167,10 @@ describe 'Tag Rules' do within ".customer_tag #tr_1" do within "li.tag-item", text: "member ✖" do find("a.remove-button").click end fill_in_tag "volunteers-only1" - expect(page).to have_select2 "enterprise_tag_rules_attributes_1_preferred_matched_"\ + expect(page).to have_select2 "enterprise_tag_rules_attributes_1_preferred_matched_" \ "variants_visibility", selected: 'VISIBLE' select2_select 'NOT VISIBLE', - from: "enterprise_tag_rules_attributes_1_preferred_matched_"\ + from: "enterprise_tag_rules_attributes_1_preferred_matched_" \ "variants_visibility" end @@ -178,10 +178,10 @@ describe 'Tag Rules' do within ".customer_tag #tr_2" do within "li.tag-item", text: "trusted ✖" do find("a.remove-button").click end fill_in_tag "volunteers-only2" - expect(page).to have_select2 "enterprise_tag_rules_attributes_2_preferred_matched_"\ + expect(page).to have_select2 "enterprise_tag_rules_attributes_2_preferred_matched_" \ "payment_methods_visibility", selected: 'NOT VISIBLE' select2_select 'VISIBLE', - from: "enterprise_tag_rules_attributes_2_preferred_matched_"\ + from: "enterprise_tag_rules_attributes_2_preferred_matched_" \ "payment_methods_visibility" end @@ -189,10 +189,10 @@ describe 'Tag Rules' do within ".customer_tag #tr_3" do within "li.tag-item", text: "wholesale ✖" do find("a.remove-button").click end fill_in_tag "volunteers-only3" - expect(page).to have_select2 "enterprise_tag_rules_attributes_3_preferred_matched_"\ + expect(page).to have_select2 "enterprise_tag_rules_attributes_3_preferred_matched_" \ "order_cycles_visibility", selected: 'VISIBLE' select2_select 'NOT VISIBLE', - from: "enterprise_tag_rules_attributes_3_preferred_matched_"\ + from: "enterprise_tag_rules_attributes_3_preferred_matched_" \ "order_cycles_visibility" end @@ -200,10 +200,10 @@ describe 'Tag Rules' do within ".customer_tag #tr_4" do within "li.tag-item", text: "local ✖" do find("a.remove-button").click end fill_in_tag "volunteers-only4" - expect(page).to have_select2 "enterprise_tag_rules_attributes_4_preferred_matched_"\ + expect(page).to have_select2 "enterprise_tag_rules_attributes_4_preferred_matched_" \ "shipping_methods_visibility", selected: 'NOT VISIBLE' select2_select 'VISIBLE', - from: "enterprise_tag_rules_attributes_4_preferred_matched_"\ + from: "enterprise_tag_rules_attributes_4_preferred_matched_" \ "shipping_methods_visibility" end =begin diff --git a/spec/system/admin/users_spec.rb b/spec/system/admin/users_spec.rb index 13fa1df495..368483e2e7 100644 --- a/spec/system/admin/users_spec.rb +++ b/spec/system/admin/users_spec.rb @@ -69,7 +69,7 @@ describe "Managing users" do fill_in "Email", with: "newemail@example.org" click_button "Update" - expect(page).to have_content("The account will be updated once "\ + expect(page).to have_content("The account will be updated once " \ "the new email is confirmed.") end diff --git a/spec/system/admin/variant_overrides_spec.rb b/spec/system/admin/variant_overrides_spec.rb index 3229f4a2fc..ad96a6a51a 100644 --- a/spec/system/admin/variant_overrides_spec.rb +++ b/spec/system/admin/variant_overrides_spec.rb @@ -219,7 +219,7 @@ describe " # We need to wait_until because the save action is not fast enough # for the have_content matcher wait_until { page.find("#status-message").text != "Saving..." } - expect(page).to have_content "I couldn't get authorisation to save those changes, "\ + expect(page).to have_content "I couldn't get authorisation to save those changes, " \ "so they remain unsaved." end.to change(VariantOverride, :count).by(0) end @@ -233,7 +233,7 @@ describe " expect do click_button 'Save Changes' - expect(page).to have_content "I couldn't get authorisation to save those changes, "\ + expect(page).to have_content "I couldn't get authorisation to save those changes, " \ "so they remain unsaved." end.to change(VariantOverride, :count).by(0) end @@ -415,7 +415,7 @@ describe " expect(vo.on_demand).to be_nil end - it "provides explanation when attempting to save variant override with incompatible "\ + it "provides explanation when attempting to save variant override with incompatible " \ "stock settings" do # Successfully change stock settings. select_on_demand variant, :no @@ -479,13 +479,13 @@ describe " select2_select hub.name, from: 'hub_id' end - it "alerts the user to the presence of new products, and allows them to be added "\ + it "alerts the user to the presence of new products, and allows them to be added " \ "or hidden" do expect(page).to have_no_selector "table#variant-overrides tr#v_#{variant1.id}" expect(page).to have_no_selector "table#variant-overrides tr#v_#{variant2.id}" expect(page).to have_selector '.alert-row span.message', - text: "There are 1 new products available to add to your "\ + text: "There are 1 new products available to add to your " \ "inventory." click_button "Review Now" diff --git a/spec/system/consumer/authentication_spec.rb b/spec/system/consumer/authentication_spec.rb index a9b1dbe3a6..389261da98 100644 --- a/spec/system/consumer/authentication_spec.rb +++ b/spec/system/consumer/authentication_spec.rb @@ -65,14 +65,14 @@ describe "Authentication" do fill_in "Password", with: user.password click_login_button - expect(page).to have_content 'You must confirm your email address before you can '\ + expect(page).to have_content 'You must confirm your email address before you can ' \ 'reset your password.' expect do page.find("a", text: 'Resend confirmation email.').click end.to enqueue_job ActionMailer::MailDeliveryJob expect(enqueued_jobs.last.to_s).to match "confirmation_instructions" - expect(page).to have_content 'You will receive an email with instructions about '\ + expect(page).to have_content 'You will receive an email with instructions about ' \ 'how to confirm your account in a few minutes.' visit spree.spree_user_confirmation_path(confirmation_token: user.confirmation_token) @@ -115,8 +115,8 @@ describe "Authentication" do expect do click_signup_button - expect(page).to have_content 'A message with a confirmation link has been sent to '\ - 'your email address. Please open the link to activate '\ + expect(page).to have_content 'A message with a confirmation link has been sent to ' \ + 'your email address. Please open the link to activate ' \ 'your account.' end.to enqueue_job ActionMailer::MailDeliveryJob end @@ -152,10 +152,10 @@ describe "Authentication" do it "cannot reset password before confirming email" do fill_in "Your email", with: email click_reset_password_button - expect(page).to have_content 'You must confirm your email address before you can '\ + expect(page).to have_content 'You must confirm your email address before you can ' \ 'reset your password.' page.find("a", text: 'Resend confirmation email.').click - expect(page).to have_content 'You will receive an email with instructions about '\ + expect(page).to have_content 'You will receive an email with instructions about ' \ 'how to confirm your account in a few minutes.' visit spree.spree_user_confirmation_path(confirmation_token: user.confirmation_token) diff --git a/spec/system/consumer/caching/shops_caching_spec.rb b/spec/system/consumer/caching/shops_caching_spec.rb index 53d876267f..11edcc667e 100644 --- a/spec/system/consumer/caching/shops_caching_spec.rb +++ b/spec/system/consumer/caching/shops_caching_spec.rb @@ -61,12 +61,12 @@ describe "Shops caching", caching: true do "#{Capybara.current_session.server.host}:#{Capybara.current_session.server.port}" } let(:taxons_key) { - "views/#{test_domain}/api/v0/order_cycles/#{order_cycle.id}/"\ - "taxons.json?distributor=#{distributor.id}" + "views/#{test_domain}/api/v0/order_cycles/#{order_cycle.id}/" \ + "taxons.json?distributor=#{distributor.id}" } let(:properties_key) { - "views/#{test_domain}/api/v0/order_cycles/#{order_cycle.id}/"\ - "properties.json?distributor=#{distributor.id}" + "views/#{test_domain}/api/v0/order_cycles/#{order_cycle.id}/" \ + "properties.json?distributor=#{distributor.id}" } let(:options) { { expires_in: CacheService::FILTERS_EXPIRY } } diff --git a/spec/system/consumer/cookies_spec.rb b/spec/system/consumer/cookies_spec.rb index b618ee3a7d..bf0fb1d44d 100644 --- a/spec/system/consumer/cookies_spec.rb +++ b/spec/system/consumer/cookies_spec.rb @@ -25,7 +25,7 @@ describe "Cookies", caching: true do expect_not_visible_cookies_banner end - scenario "banner contains cookies policy link that opens coookies policy page and "\ + scenario "banner contains cookies policy link that opens coookies policy page and " \ "closes banner" do click_banner_cookies_policy_link_and_wait expect_visible_cookies_policy_page @@ -35,7 +35,7 @@ describe "Cookies", caching: true do expect_visible_cookies_banner end - scenario "does not show after cookies are accepted, and policy page is opened through the "\ + scenario "does not show after cookies are accepted, and policy page is opened through the " \ "footer, and closed again (bug #2599)" do accept_cookies_and_wait expect_not_visible_cookies_banner @@ -64,8 +64,8 @@ describe "Cookies", caching: true do scenario "it is not showing" do Spree::Config[:cookies_consent_banner_toggle] = false visit root_path - expect(page).to have_no_content 'This site uses cookies in order to make your navigation '\ - 'frictionless and secure, and to help us understand how '\ + expect(page).to have_no_content 'This site uses cookies in order to make your navigation ' \ + 'frictionless and secure, and to help us understand how ' \ 'you use it in order to improve the features we offer.' end end @@ -177,7 +177,7 @@ describe "Cookies", caching: true do end def matomo_opt_out_iframe - 'Do you want to opt-out of Matomo analytics? We don’t collect any personal data, and Matomo '\ - 'helps us to improve our service, but we respect your choice :-)' + 'Do you want to opt-out of Matomo analytics? We don’t collect any personal data, and Matomo ' \ + 'helps us to improve our service, but we respect your choice :-)' end end diff --git a/spec/system/consumer/shopping/cart_spec.rb b/spec/system/consumer/shopping/cart_spec.rb index 270b84d728..0fccd29cd1 100644 --- a/spec/system/consumer/shopping/cart_spec.rb +++ b/spec/system/consumer/shopping/cart_spec.rb @@ -111,7 +111,7 @@ describe "full-page cart" do it "shows enterprise fees row row" do expect(page).to have_selector('#cart-detail') - expect(page).to have_content("Whole order - #{handling_fee.name} fee by distributor "\ + expect(page).to have_content("Whole order - #{handling_fee.name} fee by distributor " \ "#{order_cycle.coordinator.name}") expect(page).to have_selector '.cart-item-price', text: with_currency(0.86) @@ -237,8 +237,8 @@ describe "full-page cart" do # shows a relevant Flash message expect(page).to have_selector ".alert-box", - text: 'An item in your cart has become unavailable. '\ - 'Please update the selected quantities.' + text: 'An item in your cart has become unavailable. ' \ + 'Please update the selected quantities.' # "Continue Shopping" and "Checkout" buttons are disabled expect(page).to have_selector "a.continue-shopping[disabled=disabled]" diff --git a/spec/system/consumer/shopping/checkout_spec.rb b/spec/system/consumer/shopping/checkout_spec.rb index 6de138b04d..484d1766cb 100644 --- a/spec/system/consumer/shopping/checkout_spec.rb +++ b/spec/system/consumer/shopping/checkout_spec.rb @@ -495,8 +495,8 @@ describe "As a consumer I want to check out my cart" do check "Shipping address same as billing address?" end - it "takes us to the order confirmation page when submitted with 'same as billing address' "\ - "checked" do + it "takes us to the order confirmation page when submitted with " \ + "'same as billing address' checked" do place_order expect(page).to have_content "Your order has been processed successfully" @@ -505,7 +505,7 @@ describe "As a consumer I want to check out my cart" do expect(order.shipment_state).to eq "pending" end - it "takes us to the cart page with an error when a product becomes out of stock just "\ + it "takes us to the cart page with an error when a product becomes out of stock just " \ "before we purchase" do variant.on_demand = false variant.on_hand = 0 @@ -565,7 +565,7 @@ describe "As a consumer I want to check out my cart" do type: gateway_type) } - it "takes us to the order confirmation page when submitted "\ + it "takes us to the order confirmation page when submitted " \ "with a valid credit card" do fill_in 'Card Number', with: "4111111111111111" select 'February', from: 'secrets.card_month' @@ -582,7 +582,7 @@ describe "As a consumer I want to check out my cart" do expect(order.shipment_state).to eq "ready" end - it "shows the payment processing failed message when submitted "\ + it "shows the payment processing failed message when submitted " \ "with an invalid credit card" do fill_in 'Card Number', with: "9999999988887777" select 'February', from: 'secrets.card_month' diff --git a/spec/system/consumer/shopping/products_spec.rb b/spec/system/consumer/shopping/products_spec.rb index 44fb33bc03..59856aad03 100644 --- a/spec/system/consumer/shopping/products_spec.rb +++ b/spec/system/consumer/shopping/products_spec.rb @@ -75,9 +75,9 @@ describe "As a consumer I want to view products" do pending "#10685" product.description = 'Formatted product description: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi venenatis metus diam, - eget scelerisque nibh auctor non.
Link to an '\ - 'external site'\ - '
'
product.save!
diff --git a/spec/system/consumer/shopping/shopping_spec.rb b/spec/system/consumer/shopping/shopping_spec.rb
index d4cd8d46fe..7a5f95c454 100644
--- a/spec/system/consumer/shopping/shopping_spec.rb
+++ b/spec/system/consumer/shopping/shopping_spec.rb
@@ -375,7 +375,7 @@ describe "As a consumer I want to shop with a distributor" do
end
end
- it "returns search results for products where the search term matches one of the product's "\
+ it "returns search results for products where the search term matches one of the product's " \
"variant names" do
visit shop_path
fill_in "search", with: "Badg" # For variant with display_name "Badgers"
@@ -403,7 +403,7 @@ describe "As a consumer I want to shop with a distributor" do
# Try to go to cart
visit main_app.cart_path
- expect(page).to have_content "The hub you have selected is temporarily closed for "\
+ expect(page).to have_content "The hub you have selected is temporarily closed for " \
"orders. Please try again later."
end
end
@@ -487,7 +487,7 @@ describe "As a consumer I want to shop with a distributor" do
end
end
- it "shows quantity of remaining stock for products with quantity less < 3 when "\
+ it "shows quantity of remaining stock for products with quantity less < 3 when " \
"product_stock_display is true" do
distributor.set_preference(:product_low_stock_display, true)
variant.update on_hand: 2
@@ -520,9 +520,9 @@ describe "As a consumer I want to shop with a distributor" do
click_add_to_cart variant
within(".out-of-stock-modal") do
- expect(page).to have_content "stock levels for one or more of the products "\
+ expect(page).to have_content "stock levels for one or more of the products " \
"in your cart have reduced"
- expect(page).to have_content "#{product.name} - #{variant.unit_to_display} "\
+ expect(page).to have_content "#{product.name} - #{variant.unit_to_display} " \
"is now out of stock."
end
@@ -567,9 +567,9 @@ describe "As a consumer I want to shop with a distributor" do
wait_for_cart
within(".out-of-stock-modal") do
- expect(page).to have_content "stock levels for one or more of the products "\
+ expect(page).to have_content "stock levels for one or more of the products " \
"in your cart have reduced"
- expect(page).to have_content "#{product.name} - #{variant.unit_to_display} "\
+ expect(page).to have_content "#{product.name} - #{variant.unit_to_display} " \
"is now out of stock."
end
@@ -595,9 +595,9 @@ describe "As a consumer I want to shop with a distributor" do
click_add_to_cart variant2
within(".out-of-stock-modal") do
- expect(page).to have_content("stock levels for one or more of the products "\
+ expect(page).to have_content("stock levels for one or more of the products " \
"in your cart have reduced")
- expect(page).to have_content("#{product.name} - #{variant.unit_to_display} "\
+ expect(page).to have_content("#{product.name} - #{variant.unit_to_display} " \
"now only has 1 remaining")
end
end
@@ -615,9 +615,9 @@ describe "As a consumer I want to shop with a distributor" do
click_add_bulk_to_cart variant2
within(".out-of-stock-modal") do
- expect(page).to have_content "stock levels for one or more of the products "\
+ expect(page).to have_content "stock levels for one or more of the products " \
"in your cart have reduced"
- expect(page).to have_content "#{product.name} - #{variant.unit_to_display} "\
+ expect(page).to have_content "#{product.name} - #{variant.unit_to_display} " \
"now only has 1 remaining"
end
@@ -779,9 +779,9 @@ describe "As a consumer I want to shop with a distributor" do
def expect_out_of_stock_behavior
# Shows an "out of stock" modal, with helpful user feedback
within(".out-of-stock-modal") do
- expect(page).to have_content 'While you\'ve been shopping, the stock levels for one or more '\
- 'of the products in your cart have reduced. Here\'s what\'s '\
- 'changed:'
+ expect(page).to have_content 'While you\'ve been shopping, the stock levels for one or ' \
+ 'more of the products in your cart have reduced. Here\'s ' \
+ 'what\'s changed:'
end
# Removes the item from the client-side cart and marks the variant as unavailable
diff --git a/spec/system/consumer/shopping/unit_price_spec.rb b/spec/system/consumer/shopping/unit_price_spec.rb
index f9d8549b87..21f52f16c7 100644
--- a/spec/system/consumer/shopping/unit_price_spec.rb
+++ b/spec/system/consumer/shopping/unit_price_spec.rb
@@ -32,7 +32,7 @@ describe "As a consumer, I want to check unit price information for a product" d
visit shop_path
end
- it "one click on the question mark icon should open the tooltip, "\
+ it "one click on the question mark icon should open the tooltip, " \
"another click should close it" do
expect(page).to have_selector '.variant-unit-price'
within '.variant-unit-price' do
@@ -41,15 +41,15 @@ describe "As a consumer, I want to check unit price information for a product" d
find('.question-mark-icon').click
expect(page).to have_selector '.joyride-tip-guide.question-mark-tooltip'
within '.joyride-tip-guide.question-mark-tooltip' do
- expect(page).to have_content('This is the unit price of this product. '\
- 'It allows you to compare the price of products '\
+ expect(page).to have_content('This is the unit price of this product. ' \
+ 'It allows you to compare the price of products ' \
'independent of packaging sizes & weights.')
end
page.find("body").click
expect(page).not_to have_selector '.joyride-tip-guide.question-mark-tooltip'
- expect(page).to have_no_content('This is the unit price of this product. '\
- 'It allows you to compare the price of products '\
+ expect(page).to have_no_content('This is the unit price of this product. ' \
+ 'It allows you to compare the price of products ' \
'independent of packaging sizes & weights.')
end
end
@@ -66,14 +66,14 @@ describe "As a consumer, I want to check unit price information for a product" d
find(".cart-content .question-mark-icon").click
expect(page).to have_selector '.joyride-tip-guide.question-mark-tooltip'
within '.joyride-tip-guide.question-mark-tooltip' do
- expect(page).to have_content('This is the unit price of this product. '\
- 'It allows you to compare the price of products '\
+ expect(page).to have_content('This is the unit price of this product. ' \
+ 'It allows you to compare the price of products ' \
'independent of packaging sizes & weights.')
end
page.find("body").click
expect(page).not_to have_selector '.joyride-tip-guide.question-mark-tooltip'
- expect(page).to have_no_content('This is the unit price of this product. '\
- 'It allows you to compare the price of products '\
+ expect(page).to have_no_content('This is the unit price of this product. ' \
+ 'It allows you to compare the price of products ' \
'independent of packaging sizes & weights.')
end
end
diff --git a/spec/system/consumer/split_checkout_spec.rb b/spec/system/consumer/split_checkout_spec.rb
index 70cfb921c5..d7a25368aa 100644
--- a/spec/system/consumer/split_checkout_spec.rb
+++ b/spec/system/consumer/split_checkout_spec.rb
@@ -158,7 +158,7 @@ describe "As a consumer, I want to checkout my order" do
visit checkout_path
expect(page).to have_content(
- "Checkout is not possible due to absence of shipping options. "\
+ "Checkout is not possible due to absence of shipping options. " \
"Please contact the shop owner."
)
end
@@ -218,10 +218,10 @@ describe "As a consumer, I want to checkout my order" do
it "should display error message in the right order" do
expect(page).to have_content(
- "Customer E-Mail can't be blank, Customer E-Mail is invalid, Customer phone can't "\
- "be blank, Billing address first name can't be blank, Billing address last name "\
- "can't be blank, Billing address (Street + House number) can't be blank, Billing "\
- "address city can't be blank, Billing address postcode can't be blank, and "\
+ "Customer E-Mail can't be blank, Customer E-Mail is invalid, Customer phone can't " \
+ "be blank, Billing address first name can't be blank, Billing address last name " \
+ "can't be blank, Billing address (Street + House number) can't be blank, Billing " \
+ "address city can't be blank, Billing address postcode can't be blank, and " \
"Shipping method Select a shipping method"
)
end
@@ -343,7 +343,7 @@ describe "As a consumer, I want to checkout my order" do
context "details step" do
context "when form is submitted but invalid" do
- it "display the checkbox about shipping address same as billing address "\
+ it "display the checkbox about shipping address same as billing address " \
"when selecting a shipping method that requires ship address" do
choose free_shipping_with_required_address.name
check "Shipping address same as billing address?"
@@ -975,7 +975,7 @@ describe "As a consumer, I want to checkout my order" do
click_link "Payment method"
- expect(page).to have_content("You can review and confirm your order in the next step "\
+ expect(page).to have_content("You can review and confirm your order in the next step " \
"which includes the final costs.")
end
end
@@ -1184,7 +1184,7 @@ describe "As a consumer, I want to checkout my order" do
expect(page).to have_link("cart", href: "/cart#bought-products")
click_on "cart"
expect(page).to have_text(
- "#{prev_order.line_items.length} "\
+ "#{prev_order.line_items.length} " \
"additional items already confirmed for this order cycle"
)
end