diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 9d221c9130..5030b82a9a 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -449,24 +449,6 @@ Rails/CompactBlank: - 'lib/reporting/report_ruler.rb' - 'lib/reporting/reports/enterprise_fee_summary/parameters.rb' -# Offense count: 1 -# This cop supports safe autocorrection (--autocorrect). -Rails/ExpandedDateRange: - Exclude: - - 'app/models/spree/product.rb' - -# Offense count: 5 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: EnforcedStyle. -# SupportedStyles: slashes, arguments -Rails/FilePath: - Exclude: - - 'app/models/product_import/product_importer.rb' - - 'lib/tasks/karma.rake' - - 'spec/base_spec_helper.rb' - - 'spec/models/content_configuration_spec.rb' - - 'spec/support/downloads_helper.rb' - # Offense count: 8 # Configuration parameters: Include. # Include: app/models/**/*.rb @@ -520,14 +502,6 @@ Rails/HelperInstanceVariable: - 'app/helpers/spree/admin/orders_helper.rb' - 'app/helpers/spree/orders_helper.rb' -# Offense count: 2 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: Include. -# Include: app/controllers/**/*.rb -Rails/I18nLazyLookup: - Exclude: - - 'app/controllers/admin/proxy_orders_controller.rb' - # Offense count: 8 # Configuration parameters: Include. # Include: spec/**/*.rb, test/**/*.rb @@ -671,6 +645,7 @@ Rails/RedundantPresenceValidationOnBelongsTo: - 'app/models/spree/stock_item.rb' - 'app/models/spree/stock_movement.rb' - 'app/models/spree/tax_rate.rb' + - 'app/models/spree/variant.rb' - 'app/models/subscription_line_item.rb' - 'app/models/tag_rule.rb' - 'app/models/variant_override.rb' @@ -701,30 +676,14 @@ Rails/ResponseParsedBody: - 'spec/controllers/spree/credit_cards_controller_spec.rb' - 'spec/controllers/user_registrations_controller_spec.rb' -# Offense count: 4 +# Offense count: 3 # This cop supports unsafe autocorrection (--autocorrect-all). Rails/RootPathnameMethods: Exclude: - 'spec/lib/reports/orders_and_fulfillment/order_cycle_customer_totals_report_spec.rb' - - 'spec/models/content_configuration_spec.rb' - 'spec/models/terms_of_service_file_spec.rb' - 'spec/system/admin/configuration/terms_of_service_files_spec.rb' -# Offense count: 13 -# This cop supports safe autocorrection (--autocorrect). -Rails/RootPublicPath: - Exclude: - - 'app/controllers/concerns/request_timeouts.rb' - - 'lib/spree/core/controller_helpers/common.rb' - - 'spec/controllers/api/v0/product_images_controller_spec.rb' - - 'spec/controllers/api/v0/terms_and_conditions_controller_spec.rb' - - 'spec/models/terms_of_service_file_spec.rb' - - 'spec/system/admin/bulk_product_update_spec.rb' - - 'spec/system/admin/enterprises/terms_and_conditions_spec.rb' - - 'spec/system/consumer/shopping/checkout_spec.rb' - - 'spec/system/consumer/shopping/embedded_groups_spec.rb' - - 'spec/system/consumer/split_checkout_spec.rb' - # Offense count: 4 # Configuration parameters: ForbiddenMethods, AllowedMethods. # ForbiddenMethods: decrement!, decrement_counter, increment!, increment_counter, insert, insert!, insert_all, insert_all!, toggle!, touch, touch_all, update_all, update_attribute, update_column, update_columns, update_counters, upsert, upsert_all @@ -741,16 +700,6 @@ Rails/SquishedSQLHeredocs: - 'app/queries/outstanding_balance.rb' - 'spec/queries/outstanding_balance_spec.rb' -# Offense count: 24 -# This cop supports safe autocorrection (--autocorrect). -Rails/StripHeredoc: - Exclude: - - 'app/models/content_configuration.rb' - - 'app/queries/customers_with_balance.rb' - - 'app/queries/outstanding_balance.rb' - - 'lib/reporting/reports/enterprise_fee_summary/scope.rb' - - 'lib/tasks/data/truncate_data.rake' - # Offense count: 3 # This cop supports unsafe autocorrection (--autocorrect-all). # Configuration parameters: EnforcedStyle. @@ -1530,14 +1479,13 @@ Style/RedundantArgument: - 'engines/dfc_provider/app/services/authorization_control.rb' - 'spec/support/query_counter.rb' -# Offense count: 14 +# Offense count: 13 # This cop supports safe autocorrection (--autocorrect). Style/RedundantConstantBase: Exclude: - 'app/controllers/split_checkout_controller.rb' - 'app/controllers/webhook_endpoints_controller.rb' - 'config.ru' - - 'spec/base_spec_helper.rb' - 'spec/helpers/checkout_helper_spec.rb' - 'spec/models/spree/order_spec.rb' - 'spec/models/spree/payment_method_spec.rb' @@ -1558,6 +1506,13 @@ Style/RedundantInitialize: Exclude: - 'spec/models/spree/gateway_spec.rb' +# Offense count: 2 +# This cop supports unsafe autocorrection (--autocorrect-all). +Style/RedundantInterpolation: + Exclude: + - 'lib/tasks/karma.rake' + - 'spec/base_spec_helper.rb' + # Offense count: 2 # This cop supports safe autocorrection (--autocorrect). Style/RedundantRegexpArgument: diff --git a/app/controllers/admin/proxy_orders_controller.rb b/app/controllers/admin/proxy_orders_controller.rb index fbe51e5069..a5ee2b1c79 100644 --- a/app/controllers/admin/proxy_orders_controller.rb +++ b/app/controllers/admin/proxy_orders_controller.rb @@ -13,7 +13,7 @@ module Admin if @proxy_order.cancel render_as_json @proxy_order else - render json: { errors: [t('admin.proxy_orders.cancel.could_not_cancel_the_order')] }, + render json: { errors: [t('.could_not_cancel_the_order')] }, status: :unprocessable_entity end end @@ -22,7 +22,7 @@ module Admin if @proxy_order.resume render_as_json @proxy_order else - render json: { errors: [t('admin.proxy_orders.resume.could_not_resume_the_order')] }, + render json: { errors: [t('.could_not_resume_the_order')] }, status: :unprocessable_entity end end diff --git a/app/controllers/concerns/request_timeouts.rb b/app/controllers/concerns/request_timeouts.rb index 691cba2a3d..8e2705213a 100644 --- a/app/controllers/concerns/request_timeouts.rb +++ b/app/controllers/concerns/request_timeouts.rb @@ -16,7 +16,7 @@ module RequestTimeouts respond_to do |type| type.html { render status: :gateway_timeout, - file: Rails.root.join("public/500.html"), + file: Rails.public_path.join('500.html'), formats: [:html], layout: nil } diff --git a/app/models/content_configuration.rb b/app/models/content_configuration.rb index 2d473db24f..9276e97a4c 100644 --- a/app/models/content_configuration.rb +++ b/app/models/content_configuration.rb @@ -71,7 +71,7 @@ class ContentConfiguration < Spree::Preferences::Configuration preference :footer_pinterest_url, :string, default: "" preference :footer_email, :string, default: "hello@openfoodnetwork.org" preference :community_forum_url, :string, default: "http://community.openfoodnetwork.org" - preference :footer_links_md, :text, default: <<-EOS.strip_heredoc + preference :footer_links_md, :text, default: <<~EOS [Newsletter sign-up](/) [News](/) diff --git a/app/models/product_import/product_importer.rb b/app/models/product_import/product_importer.rb index 7d0758333d..4f7401cf7d 100644 --- a/app/models/product_import/product_importer.rb +++ b/app/models/product_import/product_importer.rb @@ -287,7 +287,7 @@ module ProductImport end def delete_uploaded_file - return unless @file.path == Rails.root.join('tmp', 'product_import').to_s + return unless @file.path == Rails.root.join("tmp/product_import").to_s File.delete(@file) end diff --git a/app/models/spree/product.rb b/app/models/spree/product.rb index 2f946bf1f1..0378df7322 100755 --- a/app/models/spree/product.rb +++ b/app/models/spree/product.rb @@ -104,7 +104,7 @@ module Spree import_date = Time.zone.parse import_date if import_date.is_a? String import_date = import_date.to_date joins(:variants).merge(Spree::Variant. - where(import_date: import_date.beginning_of_day..import_date.end_of_day)) + where(import_date: import_date.all_day)) } scope :with_order_cycles_inner, -> { diff --git a/app/queries/customers_with_balance.rb b/app/queries/customers_with_balance.rb index 553ca88cec..623190ff4c 100644 --- a/app/queries/customers_with_balance.rb +++ b/app/queries/customers_with_balance.rb @@ -20,7 +20,7 @@ class CustomersWithBalance # The resulting orders are in states that belong after the checkout. Only these can be considered # for a customer's balance. def left_join_complete_orders - <<-SQL.strip_heredoc + <<~SQL LEFT JOIN spree_orders ON spree_orders.customer_id = customers.id AND #{finalized_states.to_sql} SQL diff --git a/app/queries/outstanding_balance.rb b/app/queries/outstanding_balance.rb index 5f4b5b921f..637451b25c 100644 --- a/app/queries/outstanding_balance.rb +++ b/app/queries/outstanding_balance.rb @@ -29,7 +29,7 @@ class OutstandingBalance # Arel doesn't support CASE statements until v7.1.0 so we'll have to wait with SQL literals # a little longer. See https://github.com/rails/arel/pull/400 for details. def statement - <<-SQL.strip_heredoc + <<~SQL CASE WHEN "spree_orders"."state" IN #{non_fulfilled_states_group.to_sql} THEN "spree_orders"."payment_total" WHEN "spree_orders"."state" IS NOT NULL THEN "spree_orders"."payment_total" - "spree_orders"."total" ELSE 0 END diff --git a/lib/reporting/reports/enterprise_fee_summary/scope.rb b/lib/reporting/reports/enterprise_fee_summary/scope.rb index 3a57ea027c..7b6ed51425 100644 --- a/lib/reporting/reports/enterprise_fee_summary/scope.rb +++ b/lib/reporting/reports/enterprise_fee_summary/scope.rb @@ -68,7 +68,7 @@ module Reporting def include_adjustment_metadata join_scope( - <<-JOIN_STRING.strip_heredoc + <<~JOIN_STRING LEFT OUTER JOIN adjustment_metadata ON (adjustment_metadata.adjustment_id = spree_adjustments.id) JOIN_STRING @@ -81,7 +81,7 @@ module Reporting # * Hub def include_order_details join_scope( - <<-JOIN_STRING.strip_heredoc + <<~JOIN_STRING LEFT OUTER JOIN spree_orders ON ( spree_orders.id = spree_adjustments.order_id @@ -93,7 +93,7 @@ module Reporting join_scope("LEFT OUTER JOIN customers ON (customers.id = spree_orders.customer_id)") join_scope( - <<-JOIN_STRING.strip_heredoc + <<~JOIN_STRING LEFT OUTER JOIN enterprises AS hubs ON (hubs.id = spree_orders.distributor_id) JOIN_STRING @@ -106,7 +106,7 @@ module Reporting # * Payment method def include_payment_fee_details join_scope( - <<-JOIN_STRING.strip_heredoc + <<~JOIN_STRING LEFT OUTER JOIN spree_payment_methods ON ( spree_adjustments.originator_type = 'Spree::PaymentMethod' @@ -116,7 +116,7 @@ module Reporting ) join_scope( - <<-JOIN_STRING.strip_heredoc + <<~JOIN_STRING LEFT OUTER JOIN enterprises AS payment_hubs ON ( spree_payment_methods.id IS NOT NULL @@ -132,7 +132,7 @@ module Reporting # * Shipping method def include_shipping_fee_details join_scope( - <<-JOIN_STRING.strip_heredoc + <<~JOIN_STRING LEFT OUTER JOIN spree_shipping_methods ON ( spree_adjustments.originator_type = 'Spree::ShippingMethod' @@ -148,7 +148,7 @@ module Reporting # * Enterprise fee tax category def include_enterprise_fee_details join_scope( - <<-JOIN_STRING.strip_heredoc + <<~JOIN_STRING LEFT OUTER JOIN enterprise_fees ON ( spree_adjustments.originator_type = 'EnterpriseFee' @@ -158,14 +158,14 @@ module Reporting ) join_scope( - <<-JOIN_STRING.strip_heredoc + <<~JOIN_STRING LEFT OUTER JOIN enterprises ON (enterprises.id = enterprise_fees.enterprise_id) JOIN_STRING ) join_scope( - <<-JOIN_STRING.strip_heredoc + <<~JOIN_STRING LEFT OUTER JOIN spree_tax_categories ON (spree_tax_categories.id = enterprise_fees.tax_category_id) JOIN_STRING @@ -179,7 +179,7 @@ module Reporting # * Distributor def include_order_source_details join_scope( - <<-JOIN_STRING.strip_heredoc + <<~JOIN_STRING LEFT OUTER JOIN spree_orders AS adjustment_source_orders ON ( spree_adjustments.adjustable_type = 'Spree::Order' @@ -189,7 +189,7 @@ module Reporting ) join_scope( - <<-JOIN_STRING.strip_heredoc + <<~JOIN_STRING LEFT OUTER JOIN enterprises AS adjustment_source_distributors ON (adjustment_source_distributors.id = adjustment_source_orders.distributor_id) JOIN_STRING @@ -205,7 +205,7 @@ module Reporting # * Tax category of product, if enterprise fee tells to inherit def include_line_item_source_details join_scope( - <<-JOIN_STRING.strip_heredoc + <<~JOIN_STRING LEFT OUTER JOIN spree_line_items ON ( spree_adjustments.adjustable_type = 'Spree::LineItem' @@ -215,7 +215,7 @@ module Reporting ) join_scope( - <<-JOIN_STRING.strip_heredoc + <<~JOIN_STRING LEFT OUTER JOIN spree_variants ON ( spree_adjustments.adjustable_type = 'Spree::LineItem' @@ -225,14 +225,14 @@ module Reporting ) join_scope( - <<-JOIN_STRING.strip_heredoc + <<~JOIN_STRING LEFT OUTER JOIN spree_products ON (spree_products.id = spree_variants.product_id) JOIN_STRING ) join_scope( - <<-JOIN_STRING.strip_heredoc + <<~JOIN_STRING LEFT OUTER JOIN spree_tax_categories AS product_tax_categories ON ( enterprise_fees.inherits_tax_category IS TRUE @@ -250,7 +250,7 @@ module Reporting # * Incoming exchange variant def include_incoming_exchange_details join_scope( - <<-JOIN_STRING.strip_heredoc + <<~JOIN_STRING LEFT OUTER JOIN ( exchange_variants AS incoming_exchange_variants @@ -271,7 +271,7 @@ module Reporting ) join_scope( - <<-JOIN_STRING.strip_heredoc + <<~JOIN_STRING LEFT OUTER JOIN enterprises AS incoming_exchange_enterprises ON (incoming_exchange_enterprises.id = incoming_exchanges.sender_id) JOIN_STRING @@ -286,7 +286,7 @@ module Reporting # * Outgoing exchange variant def include_outgoing_exchange_details join_scope( - <<-JOIN_STRING.strip_heredoc + <<~JOIN_STRING LEFT OUTER JOIN ( exchange_variants AS outgoing_exchange_variants @@ -307,7 +307,7 @@ module Reporting ) join_scope( - <<-JOIN_STRING.strip_heredoc + <<~JOIN_STRING LEFT OUTER JOIN enterprises AS outgoing_exchange_enterprises ON (outgoing_exchange_enterprises.id = outgoing_exchanges.receiver_id) JOIN_STRING @@ -366,7 +366,7 @@ module Reporting def select_attributes chain_to_scope do select( - <<-JOIN_STRING.strip_heredoc + <<~JOIN_STRING SUM(spree_adjustments.amount) AS total_amount, spree_payment_methods.name AS payment_method_name, spree_shipping_methods.name AS shipping_method_name, diff --git a/lib/spree/core/controller_helpers/common.rb b/lib/spree/core/controller_helpers/common.rb index 28090659b6..8f0da80bc7 100644 --- a/lib/spree/core/controller_helpers/common.rb +++ b/lib/spree/core/controller_helpers/common.rb @@ -42,7 +42,7 @@ module Spree respond_to do |type| type.html { render status: :not_found, - file: Rails.root.join("public/404.html"), + file: Rails.public_path.join('404.html'), formats: [:html], layout: nil } diff --git a/lib/tasks/data/truncate_data.rake b/lib/tasks/data/truncate_data.rake index 65075a3ffb..b422d04980 100644 --- a/lib/tasks/data/truncate_data.rake +++ b/lib/tasks/data/truncate_data.rake @@ -32,11 +32,11 @@ namespace :ofn do end def warn_with_confirmation - message = <<-MSG.strip_heredoc - \n - <% highlighted_message = "This will permanently change DB contents. This is not meant to be run in production as it needs more thorough testing." %> - <%= color(highlighted_message, :blink, :on_red) %> - Are you sure you want to proceed? (y/N) + message = <<~MSG + \n + <% highlighted_message = "This will permanently change DB contents. This is not meant to be run in production as it needs more thorough testing." %> + <%= color(highlighted_message, :blink, :on_red) %> + Are you sure you want to proceed? (y/N) MSG exit unless HighLine.new.agree(message) { |question| question.default = "N" } diff --git a/lib/tasks/karma.rake b/lib/tasks/karma.rake index fe90a8d04f..2044fd04ef 100644 --- a/lib/tasks/karma.rake +++ b/lib/tasks/karma.rake @@ -39,6 +39,6 @@ namespace :karma do I18n::JS::DEFAULT_EXPORT_DIR_PATH.replace('tmp/javascripts') I18n::JS.export - "#{Rails.root.join(I18n::JS::DEFAULT_EXPORT_DIR_PATH)}/translations.js" + "#{Rails.root.join(I18n::JS::DEFAULT_EXPORT_DIR_PATH, 'translations.js')}" end end diff --git a/spec/base_spec_helper.rb b/spec/base_spec_helper.rb index eb0f8f3c76..ca66ef310e 100644 --- a/spec/base_spec_helper.rb +++ b/spec/base_spec_helper.rb @@ -55,7 +55,7 @@ FactoryBot::SyntaxRunner.include FileHelper RSpec.configure do |config| # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures - config.fixture_path = "#{::Rails.root}/spec/fixtures" + config.fixture_path = "#{Rails.root.join('spec/fixtures')}" # If you're not using ActiveRecord, or you'd prefer not to run each of your # examples within a transaction, remove the following line or assign false diff --git a/spec/controllers/api/v0/product_images_controller_spec.rb b/spec/controllers/api/v0/product_images_controller_spec.rb index 1e2ffee08c..464e9025cc 100644 --- a/spec/controllers/api/v0/product_images_controller_spec.rb +++ b/spec/controllers/api/v0/product_images_controller_spec.rb @@ -10,7 +10,7 @@ describe Api::V0::ProductImagesController, type: :controller do describe "uploading an image" do let(:image) { Rack::Test::UploadedFile.new(black_logo_file, 'image/png') } let(:pdf) { Rack::Test::UploadedFile.new(pdf_path, 'application/pdf') } - let(:pdf_path) { Rails.root.join("public/Terms-of-service.pdf") } + let(:pdf_path) { Rails.public_path.join('Terms-of-service.pdf') } let(:product_without_image) { create(:product) } let(:product_with_image) { create(:product_with_image) } let(:current_api_user) { create(:admin_user) } diff --git a/spec/controllers/api/v0/terms_and_conditions_controller_spec.rb b/spec/controllers/api/v0/terms_and_conditions_controller_spec.rb index 142697c88a..89d0b6fc08 100644 --- a/spec/controllers/api/v0/terms_and_conditions_controller_spec.rb +++ b/spec/controllers/api/v0/terms_and_conditions_controller_spec.rb @@ -12,7 +12,7 @@ module Api let(:enterprise_manager) { create(:user, enterprises: [enterprise]) } describe "removing terms and conditions file" do - let(:terms_file_path) { Rails.root.join("public/Terms-of-service.pdf") } + let(:terms_file_path) { Rails.public_path.join('Terms-of-service.pdf') } let(:terms_and_conditions_file) { Rack::Test::UploadedFile.new(terms_file_path, "application/pdf") } diff --git a/spec/models/content_configuration_spec.rb b/spec/models/content_configuration_spec.rb index 141d4111cf..07f8bcc18d 100644 --- a/spec/models/content_configuration_spec.rb +++ b/spec/models/content_configuration_spec.rb @@ -12,7 +12,7 @@ describe ContentConfiguration do end def image_exist?(default_url) - File.exist?(File.join(Rails.root, 'public', default_url)) + Rails.public_path.join(*default_url.split("/")).exist? end end end diff --git a/spec/models/terms_of_service_file_spec.rb b/spec/models/terms_of_service_file_spec.rb index 74a28697a9..ca30c64546 100644 --- a/spec/models/terms_of_service_file_spec.rb +++ b/spec/models/terms_of_service_file_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' describe TermsOfServiceFile do - let(:pdf) { File.open(Rails.root.join("public/Terms-of-service.pdf")) } + let(:pdf) { File.open(Rails.public_path.join('Terms-of-service.pdf')) } let(:upload) { Rack::Test::UploadedFile.new(pdf, "application/pdf") } describe ".current" do diff --git a/spec/support/downloads_helper.rb b/spec/support/downloads_helper.rb index 2a6bc73b0c..d17f657e0d 100644 --- a/spec/support/downloads_helper.rb +++ b/spec/support/downloads_helper.rb @@ -4,7 +4,7 @@ module DownloadsHelper TIMEOUT = 10 def self.path - Rails.root.join("tmp", "capybara") + Rails.root.join("tmp/capybara") end def downloaded_filename diff --git a/spec/system/admin/bulk_product_update_spec.rb b/spec/system/admin/bulk_product_update_spec.rb index a2876661e7..cb1c80e281 100644 --- a/spec/system/admin/bulk_product_update_spec.rb +++ b/spec/system/admin/bulk_product_update_spec.rb @@ -904,7 +904,7 @@ describe ' expect(page).to have_css "img.preview" # Upload a new image file - attach_file 'image-upload', Rails.root.join("public/500.jpg"), visible: false + attach_file 'image-upload', Rails.public_path.join('500.jpg'), visible: false # Shows spinner whilst loading expect(page).to have_css ".spinner" diff --git a/spec/system/admin/enterprises/terms_and_conditions_spec.rb b/spec/system/admin/enterprises/terms_and_conditions_spec.rb index 7599259688..9b8eace1f2 100644 --- a/spec/system/admin/enterprises/terms_and_conditions_spec.rb +++ b/spec/system/admin/enterprises/terms_and_conditions_spec.rb @@ -24,8 +24,8 @@ describe "Uploading Terms and Conditions PDF" do end end - let(:original_terms) { Rails.root.join("public/Terms-of-service.pdf") } - let(:updated_terms) { Rails.root.join("public/Terms-of-ServiceUK.pdf") } + let(:original_terms) { Rails.public_path.join('Terms-of-service.pdf') } + let(:updated_terms) { Rails.public_path.join('Terms-of-ServiceUK.pdf') } it "uploading terms and conditions" do go_to_business_details diff --git a/spec/system/consumer/shopping/checkout_spec.rb b/spec/system/consumer/shopping/checkout_spec.rb index 484d1766cb..59106028e0 100644 --- a/spec/system/consumer/shopping/checkout_spec.rb +++ b/spec/system/consumer/shopping/checkout_spec.rb @@ -91,7 +91,7 @@ describe "As a consumer I want to check out my cart" do let(:user) { create(:user) } let(:pdf_upload) { Rack::Test::UploadedFile.new( - Rails.root.join("public/Terms-of-service.pdf"), + Rails.public_path.join('Terms-of-service.pdf'), "application/pdf" ) } diff --git a/spec/system/consumer/shopping/embedded_groups_spec.rb b/spec/system/consumer/shopping/embedded_groups_spec.rb index 7927129fca..4b3db6ea9c 100644 --- a/spec/system/consumer/shopping/embedded_groups_spec.rb +++ b/spec/system/consumer/shopping/embedded_groups_spec.rb @@ -15,7 +15,7 @@ describe "Using embedded shopfront functionality" do FileUtils.copy( Rails.root.join("spec/fixtures/files/embedded-group-preview.html"), - Rails.root.join("public/embedded-group-preview.html") + Rails.public_path.join('embedded-group-preview.html') ) visit "/embedded-group-preview.html?#{group.permalink}" @@ -23,7 +23,7 @@ describe "Using embedded shopfront functionality" do after do FileUtils.remove( - Rails.root.join("public/embedded-group-preview.html") + Rails.public_path.join('embedded-group-preview.html') ) end diff --git a/spec/system/consumer/split_checkout_spec.rb b/spec/system/consumer/split_checkout_spec.rb index e2f962a13f..d648476e20 100644 --- a/spec/system/consumer/split_checkout_spec.rb +++ b/spec/system/consumer/split_checkout_spec.rb @@ -993,8 +993,8 @@ describe "As a consumer, I want to checkout my order" do describe "terms and conditions" do let(:customer) { create(:customer, enterprise: order.distributor, user: user) } let(:tos_url) { "https://example.org/tos" } - let(:system_terms_path) { Rails.root.join("public/Terms-of-service.pdf") } - let(:shop_terms_path) { Rails.root.join("public/Terms-of-ServiceUK.pdf") } + let(:system_terms_path) { Rails.public_path.join('Terms-of-service.pdf') } + let(:shop_terms_path) { Rails.public_path.join('Terms-of-ServiceUK.pdf') } let(:system_terms) { Rack::Test::UploadedFile.new(system_terms_path, "application/pdf") }