mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-10 23:07:47 +00:00
Convert enterprise relationship permission to string presentation
This commit is contained in:
@@ -16,3 +16,8 @@ angular.module("ofn.admin").factory 'EnterpriseRelationships', ($http, enterpris
|
||||
delete: (er) ->
|
||||
$http.delete('/admin/enterprise_relationships/' + er.id).success (data) =>
|
||||
@enterprise_relationships.splice @enterprise_relationships.indexOf(er), 1
|
||||
|
||||
permission_presentation: (permission) ->
|
||||
switch permission
|
||||
when "add_products_to_order_cycle" then "can add products to order cycle from"
|
||||
when "manage_products" then "can manage the products of"
|
||||
@@ -0,0 +1,16 @@
|
||||
describe "enterprise relationships", ->
|
||||
EnterpriseRelationships = null
|
||||
enterprise_relationships = []
|
||||
|
||||
beforeEach ->
|
||||
module "ofn.admin"
|
||||
module ($provide) ->
|
||||
$provide.value "enterprise_relationships", enterprise_relationships
|
||||
null
|
||||
|
||||
beforeEach inject (_EnterpriseRelationships_) ->
|
||||
EnterpriseRelationships = _EnterpriseRelationships_
|
||||
|
||||
it "presents permission names", ->
|
||||
expect(EnterpriseRelationships.permission_presentation("add_products_to_order_cycle")).toEqual "can add products to order cycle from"
|
||||
expect(EnterpriseRelationships.permission_presentation("manage_products")).toEqual "can manage the products of"
|
||||
Reference in New Issue
Block a user