mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-27 01:43:22 +00:00
Adding set_sells action to enterprises
This commit is contained in:
@@ -50,7 +50,7 @@ class AbilityDecorator
|
||||
can [:admin, :index, :read, :create, :edit, :update_positions, :destroy], ProducerProperty
|
||||
|
||||
can [:admin, :index, :create], Enterprise
|
||||
can [:read, :edit, :update, :bulk_update], Enterprise do |enterprise|
|
||||
can [:read, :edit, :update, :bulk_update, :set_sells], Enterprise do |enterprise|
|
||||
user.enterprises.include? enterprise
|
||||
end
|
||||
|
||||
|
||||
@@ -48,6 +48,10 @@ Openfoodnetwork::Application.routes.draw do
|
||||
post :bulk_update, as: :bulk_update
|
||||
end
|
||||
|
||||
member do
|
||||
post :set_sells
|
||||
end
|
||||
|
||||
resources :producer_properties do
|
||||
post :update_positions, on: :collection
|
||||
end
|
||||
|
||||
@@ -280,11 +280,11 @@ module Spree
|
||||
end
|
||||
|
||||
it 'should have the ability to read and edit enterprises that I manage' do
|
||||
should have_ability([:read, :edit, :update, :bulk_update], for: s1)
|
||||
should have_ability([:read, :edit, :update, :bulk_update, :set_sells], for: s1)
|
||||
end
|
||||
|
||||
it 'should not have the ability to read and edit enterprises that I do not manage' do
|
||||
should_not have_ability([:read, :edit, :update, :bulk_update], for: s2)
|
||||
should_not have_ability([:read, :edit, :update, :bulk_update, :set_sells], for: s2)
|
||||
end
|
||||
|
||||
it 'should have the ability administrate and create enterpises' do
|
||||
|
||||
Reference in New Issue
Block a user