From 07aececdcff76f8ac46cf2a2215ab899022aa60e Mon Sep 17 00:00:00 2001 From: luisramos0 Date: Wed, 31 Jul 2019 09:47:29 +0100 Subject: [PATCH] Remove unused route api/products managed --- .../spree/api/products_controller.rb | 11 ----------- config/routes/spree.rb | 1 - .../spree/api/products_controller_spec.rb | 17 ----------------- 3 files changed, 29 deletions(-) diff --git a/app/controllers/spree/api/products_controller.rb b/app/controllers/spree/api/products_controller.rb index 615596383e..03bf8a7775 100644 --- a/app/controllers/spree/api/products_controller.rb +++ b/app/controllers/spree/api/products_controller.rb @@ -58,17 +58,6 @@ module Spree respond_with(@product, status: 204) end - def managed - authorize! :admin, Spree::Product - authorize! :read, Spree::Product - - @products = product_scope. - ransack(params[:q]).result. - managed_by(current_api_user). - page(params[:page]).per(params[:per_page]) - respond_with(@products, default_template: :index) - end - # TODO: This should be named 'managed'. Is the action above used? Maybe we should remove it. def bulk_products @products = OpenFoodNetwork::Permissions.new(current_api_user).editable_products. diff --git a/config/routes/spree.rb b/config/routes/spree.rb index 05a709f0ff..2007665100 100644 --- a/config/routes/spree.rb +++ b/config/routes/spree.rb @@ -64,7 +64,6 @@ Spree::Core::Engine.routes.prepend do resources :products do collection do - get :managed get :bulk_products get :overridable end diff --git a/spec/controllers/spree/api/products_controller_spec.rb b/spec/controllers/spree/api/products_controller_spec.rb index c726487052..47907526b5 100644 --- a/spec/controllers/spree/api/products_controller_spec.rb +++ b/spec/controllers/spree/api/products_controller_spec.rb @@ -25,11 +25,6 @@ module Spree .to receive(:has_spree_role?).with("admin").and_return(false) end - it "should deny me access to managed products" do - spree_get :managed, template: 'bulk_index', format: :json - assert_unauthorized! - end - it "retrieves a list of products" do api_get :index expect(json_response["products"].first).to have_attributes(keys: all_attributes) @@ -152,12 +147,6 @@ module Spree user end - it "retrieves a list of managed products" do - spree_get :managed, template: 'bulk_index', format: :json - response_keys = json_response.first.keys - expect(attributes.all?{ |attr| response_keys.include? attr }).to eq(true) - end - it "soft deletes my products" do spree_delete :soft_delete, product_id: product.to_param, format: :json expect(response.status).to eq(204) @@ -179,12 +168,6 @@ module Spree .to receive(:has_spree_role?).with("admin").and_return(true) end - it "retrieves a list of managed products" do - spree_get :managed, template: 'bulk_index', format: :json - response_keys = json_response.first.keys - expect(attributes.all?{ |attr| response_keys.include? attr }).to eq(true) - end - it "retrieves a list of products with appropriate attributes" do spree_get :index, template: 'bulk_index', format: :json response_keys = json_response.first.keys