mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-28 21:07:16 +00:00
Remove unused route api/products managed
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -64,7 +64,6 @@ Spree::Core::Engine.routes.prepend do
|
||||
|
||||
resources :products do
|
||||
collection do
|
||||
get :managed
|
||||
get :bulk_products
|
||||
get :overridable
|
||||
end
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user