From 66ba9ff73dbd4e061debda362d3ae0cd83928978 Mon Sep 17 00:00:00 2001 From: Luis Ramos Date: Sat, 31 Oct 2020 09:50:38 +0000 Subject: [PATCH 1/5] Move Spree::Admin::BaseController to Admin::BaseController --- app/controllers/{spree => }/admin/base_controller.rb | 0 spec/controllers/{spree => }/admin/base_controller_spec.rb | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename app/controllers/{spree => }/admin/base_controller.rb (100%) rename spec/controllers/{spree => }/admin/base_controller_spec.rb (100%) diff --git a/app/controllers/spree/admin/base_controller.rb b/app/controllers/admin/base_controller.rb similarity index 100% rename from app/controllers/spree/admin/base_controller.rb rename to app/controllers/admin/base_controller.rb diff --git a/spec/controllers/spree/admin/base_controller_spec.rb b/spec/controllers/admin/base_controller_spec.rb similarity index 100% rename from spec/controllers/spree/admin/base_controller_spec.rb rename to spec/controllers/admin/base_controller_spec.rb From eb07a91acbeadfb0e9bc95703a9f0de09598780e Mon Sep 17 00:00:00 2001 From: Luis Ramos Date: Sat, 31 Oct 2020 09:52:34 +0000 Subject: [PATCH 2/5] Adapt code from Spree::Admin::BaseController to Admin::BaseController --- app/controllers/admin/base_controller.rb | 216 +++++++++--------- .../controllers/admin/base_controller_spec.rb | 4 +- 2 files changed, 109 insertions(+), 111 deletions(-) diff --git a/app/controllers/admin/base_controller.rb b/app/controllers/admin/base_controller.rb index 4f9cdbb4d0..4bc19c246e 100644 --- a/app/controllers/admin/base_controller.rb +++ b/app/controllers/admin/base_controller.rb @@ -1,119 +1,117 @@ -module Spree - module Admin - class BaseController < Spree::BaseController - ssl_required +module Admin + class BaseController < Spree::BaseController + ssl_required - helper 'spree/admin/navigation' - layout '/spree/layouts/admin' + helper 'spree/admin/navigation' + layout '/spree/layouts/admin' - include I18nHelper + include I18nHelper - before_action :authorize_admin - before_action :set_locale - before_action :warn_invalid_order_cycles, if: :html_request? + before_action :authorize_admin + before_action :set_locale + before_action :warn_invalid_order_cycles, if: :html_request? - # Warn the user when they have an active order cycle with hubs that are not ready - # for checkout (ie. does not have valid shipping and payment methods). - def warn_invalid_order_cycles - return if flash[:notice].present? + # Warn the user when they have an active order cycle with hubs that are not ready + # for checkout (ie. does not have valid shipping and payment methods). + def warn_invalid_order_cycles + return if flash[:notice].present? - warning = OrderCycleWarning.new(spree_current_user).call - flash[:notice] = warning if warning.present? + warning = OrderCycleWarning.new(spree_current_user).call + flash[:notice] = warning if warning.present? + end + + # This is in Spree::Core::ControllerHelpers::Auth + # But you can't easily reopen modules in Ruby + def unauthorized + if spree_current_user + flash[:error] = t(:authorization_failure) + redirect_to '/unauthorized' + else + store_location + redirect_to main_app.root_path(anchor: "login?after_login=#{request.env['PATH_INFO']}") + end + end + + protected + + def model_class + const_name = controller_name.classify + return "Spree::#{const_name}".constantize if Spree.const_defined?(const_name) + + nil + end + + def action + params[:action].to_sym + end + + def authorize_admin + if respond_to?(:model_class, true) && model_class + record = model_class + else + # This allows specificity for each non-resource controller + # (to be consistent with "authorize_resource :class => false", see https://github.com/ryanb/cancan/blob/60cf6a67ef59c0c9b63bc27ea0101125c4193ea6/lib/cancan/controller_resource.rb#L146) + record = self.class.to_s. + sub("Controller", ""). + underscore.split('/').last.singularize.to_sym + end + authorize! :admin, record + authorize! resource_authorize_action, record + end + + def resource_authorize_action + action + end + + def flash_message_for(object, event_sym) + resource_desc = object.class.model_name.human + resource_desc += " \"#{object.name}\"" if object.respond_to?(:name) && object.name.present? + Spree.t(event_sym, resource: resource_desc) + end + + # Index request for JSON needs to pass a CSRF token in order to prevent JSON Hijacking + def check_json_authenticity + return unless request.format.js? || request.format.json? + + return unless protect_against_forgery? + + auth_token = params[request_forgery_protection_token] + return if auth_token && form_authenticity_token == CGI.unescape(auth_token) + + raise(ActionController::InvalidAuthenticityToken) + end + + private + + def html_request? + request.format.html? + end + + def json_request? + request.format.json? + end + + def render_as_json(data, options = {}) + ams_prefix = options.delete :ams_prefix + if each_serializer_required?(data) + render options.merge(json: data, each_serializer: serializer(ams_prefix)) + else + render options.merge(json: data, serializer: serializer(ams_prefix)) + end + end + + def each_serializer_required?(data) + ['Array', 'ActiveRecord::Relation'].include?(data.class.name) + end + + def serializer(ams_prefix) + unless ams_prefix.nil? || ams_prefix_whitelist.include?(ams_prefix.to_sym) + raise "Suffix '#{ams_prefix}' not found in ams_prefix_whitelist for #{self.class.name}." end - # This is in Spree::Core::ControllerHelpers::Auth - # But you can't easily reopen modules in Ruby - def unauthorized - if spree_current_user - flash[:error] = t(:authorization_failure) - redirect_to '/unauthorized' - else - store_location - redirect_to main_app.root_path(anchor: "login?after_login=#{request.env['PATH_INFO']}") - end - end - - protected - - def model_class - const_name = controller_name.classify - return "Spree::#{const_name}".constantize if Spree.const_defined?(const_name) - - nil - end - - def action - params[:action].to_sym - end - - def authorize_admin - if respond_to?(:model_class, true) && model_class - record = model_class - else - # This allows specificity for each non-resource controller - # (to be consistent with "authorize_resource :class => false", see https://github.com/ryanb/cancan/blob/60cf6a67ef59c0c9b63bc27ea0101125c4193ea6/lib/cancan/controller_resource.rb#L146) - record = self.class.to_s. - sub("Controller", ""). - underscore.split('/').last.singularize.to_sym - end - authorize! :admin, record - authorize! resource_authorize_action, record - end - - def resource_authorize_action - action - end - - def flash_message_for(object, event_sym) - resource_desc = object.class.model_name.human - resource_desc += " \"#{object.name}\"" if object.respond_to?(:name) && object.name.present? - Spree.t(event_sym, resource: resource_desc) - end - - # Index request for JSON needs to pass a CSRF token in order to prevent JSON Hijacking - def check_json_authenticity - return unless request.format.js? || request.format.json? - - return unless protect_against_forgery? - - auth_token = params[request_forgery_protection_token] - return if auth_token && form_authenticity_token == CGI.unescape(auth_token) - - raise(ActionController::InvalidAuthenticityToken) - end - - private - - def html_request? - request.format.html? - end - - def json_request? - request.format.json? - end - - def render_as_json(data, options = {}) - ams_prefix = options.delete :ams_prefix - if each_serializer_required?(data) - render options.merge(json: data, each_serializer: serializer(ams_prefix)) - else - render options.merge(json: data, serializer: serializer(ams_prefix)) - end - end - - def each_serializer_required?(data) - ['Array', 'ActiveRecord::Relation'].include?(data.class.name) - end - - def serializer(ams_prefix) - unless ams_prefix.nil? || ams_prefix_whitelist.include?(ams_prefix.to_sym) - raise "Suffix '#{ams_prefix}' not found in ams_prefix_whitelist for #{self.class.name}." - end - - prefix = ams_prefix.andand.classify || "" - name = controller_name.classify - "::Api::Admin::#{prefix}#{name}Serializer".constantize - end + prefix = ams_prefix.andand.classify || "" + name = controller_name.classify + "::Api::Admin::#{prefix}#{name}Serializer".constantize end end end diff --git a/spec/controllers/admin/base_controller_spec.rb b/spec/controllers/admin/base_controller_spec.rb index d5b1015635..9d94e3c0c5 100644 --- a/spec/controllers/admin/base_controller_spec.rb +++ b/spec/controllers/admin/base_controller_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' -describe Spree::Admin::BaseController, type: :controller do - controller(Spree::Admin::BaseController) do +describe Admin::BaseController, type: :controller do + controller(Admin::BaseController) do def index before_filter :unauthorized render text: "" From c9972189d0d735862d4f874fd69605ff32360b90 Mon Sep 17 00:00:00 2001 From: Luis Ramos Date: Sat, 31 Oct 2020 09:56:59 +0000 Subject: [PATCH 3/5] Change usage of Spree::Admin::BaseController to Admin::BaseController --- app/controllers/admin/bulk_line_items_controller.rb | 2 +- app/controllers/admin/contents_controller.rb | 2 +- app/controllers/admin/invoice_settings_controller.rb | 2 +- app/controllers/admin/manager_invitations_controller.rb | 2 +- app/controllers/admin/matomo_settings_controller.rb | 2 +- app/controllers/admin/product_import_controller.rb | 2 +- app/controllers/admin/stripe_accounts_controller.rb | 2 +- app/controllers/admin/stripe_connect_settings_controller.rb | 2 +- app/controllers/spree/admin/general_settings_controller.rb | 2 +- app/controllers/spree/admin/invoices_controller.rb | 2 +- app/controllers/spree/admin/mail_methods_controller.rb | 2 +- .../spree/admin/orders/customer_details_controller.rb | 2 +- app/controllers/spree/admin/orders_controller.rb | 2 +- app/controllers/spree/admin/overview_controller.rb | 2 +- app/controllers/spree/admin/payments_controller.rb | 2 +- app/controllers/spree/admin/reports_controller.rb | 2 +- app/controllers/spree/admin/resource_controller.rb | 2 +- app/controllers/spree/admin/search_controller.rb | 2 +- app/controllers/spree/admin/tax_settings_controller.rb | 2 +- app/controllers/spree/admin/taxons_controller.rb | 2 +- .../order_management/reports/bulk_coop_controller.rb | 2 +- .../reports/enterprise_fee_summaries_controller.rb | 2 +- spec/features/admin/variant_overrides_spec.rb | 2 +- 23 files changed, 23 insertions(+), 23 deletions(-) diff --git a/app/controllers/admin/bulk_line_items_controller.rb b/app/controllers/admin/bulk_line_items_controller.rb index 99e3b68998..01d9396698 100644 --- a/app/controllers/admin/bulk_line_items_controller.rb +++ b/app/controllers/admin/bulk_line_items_controller.rb @@ -1,5 +1,5 @@ module Admin - class BulkLineItemsController < Spree::Admin::BaseController + class BulkLineItemsController < ::Admin::BaseController # GET /admin/bulk_line_items.json # def index diff --git a/app/controllers/admin/contents_controller.rb b/app/controllers/admin/contents_controller.rb index 1769732ec4..a3a0519259 100644 --- a/app/controllers/admin/contents_controller.rb +++ b/app/controllers/admin/contents_controller.rb @@ -1,5 +1,5 @@ module Admin - class ContentsController < Spree::Admin::BaseController + class ContentsController < ::Admin::BaseController def edit @preference_sections = preference_sections.map do |preference_section| { name: preference_section.name, preferences: preference_section.preferences } diff --git a/app/controllers/admin/invoice_settings_controller.rb b/app/controllers/admin/invoice_settings_controller.rb index bfa22205ec..7306eef3f2 100644 --- a/app/controllers/admin/invoice_settings_controller.rb +++ b/app/controllers/admin/invoice_settings_controller.rb @@ -1,5 +1,5 @@ module Admin - class InvoiceSettingsController < Spree::Admin::BaseController + class InvoiceSettingsController < ::Admin::BaseController def update Spree::Config.set(params[:preferences]) diff --git a/app/controllers/admin/manager_invitations_controller.rb b/app/controllers/admin/manager_invitations_controller.rb index 36b1554cf9..0d43aada2e 100644 --- a/app/controllers/admin/manager_invitations_controller.rb +++ b/app/controllers/admin/manager_invitations_controller.rb @@ -1,5 +1,5 @@ module Admin - class ManagerInvitationsController < Spree::Admin::BaseController + class ManagerInvitationsController < ::Admin::BaseController authorize_resource class: false def create diff --git a/app/controllers/admin/matomo_settings_controller.rb b/app/controllers/admin/matomo_settings_controller.rb index 102f5b0ed5..0687d759f6 100644 --- a/app/controllers/admin/matomo_settings_controller.rb +++ b/app/controllers/admin/matomo_settings_controller.rb @@ -1,5 +1,5 @@ module Admin - class MatomoSettingsController < Spree::Admin::BaseController + class MatomoSettingsController < ::Admin::BaseController def update Spree::Config.set(params[:preferences]) diff --git a/app/controllers/admin/product_import_controller.rb b/app/controllers/admin/product_import_controller.rb index 8a5b5834b9..0480245f30 100644 --- a/app/controllers/admin/product_import_controller.rb +++ b/app/controllers/admin/product_import_controller.rb @@ -1,7 +1,7 @@ require 'roo' module Admin - class ProductImportController < Spree::Admin::BaseController + class ProductImportController < ::Admin::BaseController before_action :validate_upload_presence, except: %i[index guide validate_data] def index diff --git a/app/controllers/admin/stripe_accounts_controller.rb b/app/controllers/admin/stripe_accounts_controller.rb index 90b4e2c85c..c9744a87b5 100644 --- a/app/controllers/admin/stripe_accounts_controller.rb +++ b/app/controllers/admin/stripe_accounts_controller.rb @@ -1,7 +1,7 @@ require 'stripe/account_connector' module Admin - class StripeAccountsController < Spree::Admin::BaseController + class StripeAccountsController < ::Admin::BaseController def connect payload = params.slice(:enterprise_id) key = Openfoodnetwork::Application.config.secret_token diff --git a/app/controllers/admin/stripe_connect_settings_controller.rb b/app/controllers/admin/stripe_connect_settings_controller.rb index 6f54722fc0..a93e012ecf 100644 --- a/app/controllers/admin/stripe_connect_settings_controller.rb +++ b/app/controllers/admin/stripe_connect_settings_controller.rb @@ -1,7 +1,7 @@ # This controller is used by super admin users to update the settings the app is using module Admin - class StripeConnectSettingsController < Spree::Admin::BaseController + class StripeConnectSettingsController < ::Admin::BaseController StripeConnectSettings = Struct.new(:stripe_connect_enabled) before_action :load_settings, only: [:edit] diff --git a/app/controllers/spree/admin/general_settings_controller.rb b/app/controllers/spree/admin/general_settings_controller.rb index 7c2ef6e695..28b4331647 100644 --- a/app/controllers/spree/admin/general_settings_controller.rb +++ b/app/controllers/spree/admin/general_settings_controller.rb @@ -1,6 +1,6 @@ module Spree module Admin - class GeneralSettingsController < Spree::Admin::BaseController + class GeneralSettingsController < ::Admin::BaseController def edit @preferences_general = [:site_name, :default_seo_title, :default_meta_keywords, :default_meta_description, :site_url, :bugherd_api_key] diff --git a/app/controllers/spree/admin/invoices_controller.rb b/app/controllers/spree/admin/invoices_controller.rb index 710fda1a3a..4ac9c7acbc 100644 --- a/app/controllers/spree/admin/invoices_controller.rb +++ b/app/controllers/spree/admin/invoices_controller.rb @@ -1,6 +1,6 @@ module Spree module Admin - class InvoicesController < Spree::Admin::BaseController + class InvoicesController < ::Admin::BaseController respond_to :json authorize_resource class: false diff --git a/app/controllers/spree/admin/mail_methods_controller.rb b/app/controllers/spree/admin/mail_methods_controller.rb index d3618488ed..2bb0418784 100644 --- a/app/controllers/spree/admin/mail_methods_controller.rb +++ b/app/controllers/spree/admin/mail_methods_controller.rb @@ -1,6 +1,6 @@ module Spree module Admin - class MailMethodsController < Spree::Admin::BaseController + class MailMethodsController < ::Admin::BaseController after_action :initialize_mail_settings def update diff --git a/app/controllers/spree/admin/orders/customer_details_controller.rb b/app/controllers/spree/admin/orders/customer_details_controller.rb index 56502d54a0..3ed4140701 100644 --- a/app/controllers/spree/admin/orders/customer_details_controller.rb +++ b/app/controllers/spree/admin/orders/customer_details_controller.rb @@ -1,7 +1,7 @@ module Spree module Admin module Orders - class CustomerDetailsController < Spree::Admin::BaseController + class CustomerDetailsController < ::Admin::BaseController before_action :load_order before_action :check_authorization before_action :set_guest_checkout_status, only: :update diff --git a/app/controllers/spree/admin/orders_controller.rb b/app/controllers/spree/admin/orders_controller.rb index 56dc8b0ed7..4f037d219b 100644 --- a/app/controllers/spree/admin/orders_controller.rb +++ b/app/controllers/spree/admin/orders_controller.rb @@ -2,7 +2,7 @@ require 'open_food_network/spree_api_key_loader' module Spree module Admin - class OrdersController < Spree::Admin::BaseController + class OrdersController < ::Admin::BaseController require 'spree/core/gateway_error' include OpenFoodNetwork::SpreeApiKeyLoader helper CheckoutHelper diff --git a/app/controllers/spree/admin/overview_controller.rb b/app/controllers/spree/admin/overview_controller.rb index d8bc38293a..79896b8f6f 100644 --- a/app/controllers/spree/admin/overview_controller.rb +++ b/app/controllers/spree/admin/overview_controller.rb @@ -1,7 +1,7 @@ # this clas was inspired (heavily) from the mephisto admin architecture module Spree module Admin - class OverviewController < Spree::Admin::BaseController + class OverviewController < ::Admin::BaseController def index @enterprises = Enterprise .managed_by(spree_current_user) diff --git a/app/controllers/spree/admin/payments_controller.rb b/app/controllers/spree/admin/payments_controller.rb index 0b5732caa1..eaaa9972a7 100644 --- a/app/controllers/spree/admin/payments_controller.rb +++ b/app/controllers/spree/admin/payments_controller.rb @@ -2,7 +2,7 @@ module Spree module Admin - class PaymentsController < Spree::Admin::BaseController + class PaymentsController < ::Admin::BaseController before_action :load_order, except: [:show] before_action :load_payment, only: [:fire, :show] before_action :load_data diff --git a/app/controllers/spree/admin/reports_controller.rb b/app/controllers/spree/admin/reports_controller.rb index a19795ca6d..a6c8bd90e9 100644 --- a/app/controllers/spree/admin/reports_controller.rb +++ b/app/controllers/spree/admin/reports_controller.rb @@ -17,7 +17,7 @@ require 'open_food_network/orders_and_fulfillments_report' module Spree module Admin - class ReportsController < Spree::Admin::BaseController + class ReportsController < ::Admin::BaseController include Spree::ReportsHelper ORDER_MANAGEMENT_ENGINE_REPORTS = [ diff --git a/app/controllers/spree/admin/resource_controller.rb b/app/controllers/spree/admin/resource_controller.rb index 00a36c81dc..340cdd4d75 100644 --- a/app/controllers/spree/admin/resource_controller.rb +++ b/app/controllers/spree/admin/resource_controller.rb @@ -2,7 +2,7 @@ require 'action_callbacks' module Spree module Admin - class ResourceController < Spree::Admin::BaseController + class ResourceController < ::Admin::BaseController helper_method :new_object_url, :edit_object_url, :object_url, :collection_url before_action :load_resource, except: [:update_positions] rescue_from ActiveRecord::RecordNotFound, with: :resource_not_found diff --git a/app/controllers/spree/admin/search_controller.rb b/app/controllers/spree/admin/search_controller.rb index 0be57cb0b3..4c2d9b92da 100644 --- a/app/controllers/spree/admin/search_controller.rb +++ b/app/controllers/spree/admin/search_controller.rb @@ -1,6 +1,6 @@ module Spree module Admin - class SearchController < Spree::Admin::BaseController + class SearchController < ::Admin::BaseController # http://spreecommerce.com/blog/2010/11/02/json-hijacking-vulnerability/ before_action :check_json_authenticity, only: :index respond_to :json diff --git a/app/controllers/spree/admin/tax_settings_controller.rb b/app/controllers/spree/admin/tax_settings_controller.rb index 8be30677e0..817db416d6 100644 --- a/app/controllers/spree/admin/tax_settings_controller.rb +++ b/app/controllers/spree/admin/tax_settings_controller.rb @@ -1,6 +1,6 @@ module Spree module Admin - class TaxSettingsController < Spree::Admin::BaseController + class TaxSettingsController < ::Admin::BaseController def update Spree::Config.set(params[:preferences]) diff --git a/app/controllers/spree/admin/taxons_controller.rb b/app/controllers/spree/admin/taxons_controller.rb index 1b9b980da2..3702eb4e16 100644 --- a/app/controllers/spree/admin/taxons_controller.rb +++ b/app/controllers/spree/admin/taxons_controller.rb @@ -1,6 +1,6 @@ module Spree module Admin - class TaxonsController < Spree::Admin::BaseController + class TaxonsController < ::Admin::BaseController respond_to :html, :json, :js def create diff --git a/engines/order_management/app/controllers/order_management/reports/bulk_coop_controller.rb b/engines/order_management/app/controllers/order_management/reports/bulk_coop_controller.rb index c1810a92b6..ae2e8885d0 100644 --- a/engines/order_management/app/controllers/order_management/reports/bulk_coop_controller.rb +++ b/engines/order_management/app/controllers/order_management/reports/bulk_coop_controller.rb @@ -2,7 +2,7 @@ module OrderManagement module Reports - class BulkCoopController < Spree::Admin::BaseController + class BulkCoopController < ::Admin::BaseController before_filter :load_report_parameters before_filter :load_permissions diff --git a/engines/order_management/app/controllers/order_management/reports/enterprise_fee_summaries_controller.rb b/engines/order_management/app/controllers/order_management/reports/enterprise_fee_summaries_controller.rb index 7cc1376034..415034f368 100644 --- a/engines/order_management/app/controllers/order_management/reports/enterprise_fee_summaries_controller.rb +++ b/engines/order_management/app/controllers/order_management/reports/enterprise_fee_summaries_controller.rb @@ -2,7 +2,7 @@ module OrderManagement module Reports - class EnterpriseFeeSummariesController < Spree::Admin::BaseController + class EnterpriseFeeSummariesController < ::Admin::BaseController before_filter :load_report_parameters before_filter :load_permissions diff --git a/spec/features/admin/variant_overrides_spec.rb b/spec/features/admin/variant_overrides_spec.rb index d28147818f..74aeee3375 100644 --- a/spec/features/admin/variant_overrides_spec.rb +++ b/spec/features/admin/variant_overrides_spec.rb @@ -196,7 +196,7 @@ feature " expect(page).to have_content "Changes to one override remain unsaved." # Set a user without suficient permissions - allow_any_instance_of(Spree::Admin::BaseController).to receive(:current_spree_user).and_return(build(:user)) + allow_any_instance_of(Admin::BaseController).to receive(:current_spree_user).and_return(build(:user)) expect do click_button 'Save Changes' From af713385d87aa73e91761d2ebab081b2cd7fa115 Mon Sep 17 00:00:00 2001 From: Luis Ramos Date: Sat, 31 Oct 2020 10:16:37 +0000 Subject: [PATCH 4/5] Add frozen string literal --- app/controllers/admin/base_controller.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/controllers/admin/base_controller.rb b/app/controllers/admin/base_controller.rb index 4bc19c246e..0e48f5e6ee 100644 --- a/app/controllers/admin/base_controller.rb +++ b/app/controllers/admin/base_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Admin class BaseController < Spree::BaseController ssl_required From fa77204e14f9e83d94cef67b4ef060e4df4ff4a4 Mon Sep 17 00:00:00 2001 From: Luis Ramos Date: Sat, 31 Oct 2020 10:44:19 +0000 Subject: [PATCH 5/5] Adapt spec to the move of the controller, in prod the call to request.env['PATH_INFO'] will work correctly --- spec/controllers/admin/base_controller_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/controllers/admin/base_controller_spec.rb b/spec/controllers/admin/base_controller_spec.rb index 9d94e3c0c5..a63028ad9f 100644 --- a/spec/controllers/admin/base_controller_spec.rb +++ b/spec/controllers/admin/base_controller_spec.rb @@ -10,7 +10,7 @@ describe Admin::BaseController, type: :controller do it "redirects to Angular login" do spree_get :index - expect(response).to redirect_to root_path(anchor: "login?after_login=/spree/admin/base") + expect(response).to redirect_to root_path(anchor: "login?after_login=/admin/base") end describe "rendering as json ActiveModelSerializer" do