Adding set_sells action to enterprises

This commit is contained in:
Rob Harrington
2014-10-23 10:27:53 +11:00
parent f60a9d7bd5
commit 2e0d5eb829
3 changed files with 7 additions and 3 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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