From 92eb5ed367f1df931ae6343ed6817aedafcfc36e Mon Sep 17 00:00:00 2001 From: Rob Harrington Date: Fri, 3 Jul 2015 15:36:27 +0800 Subject: [PATCH] Adding routes for a new admin account page for users to manage their billing preferences and access invoices --- app/models/spree/ability_decorator.rb | 2 ++ config/routes.rb | 2 ++ spec/models/spree/ability_spec.rb | 8 ++++++++ 3 files changed, 12 insertions(+) diff --git a/app/models/spree/ability_decorator.rb b/app/models/spree/ability_decorator.rb index 7d6e2ee42e..fe8995f213 100644 --- a/app/models/spree/ability_decorator.rb +++ b/app/models/spree/ability_decorator.rb @@ -90,6 +90,8 @@ class AbilityDecorator end can [:admin, :known_users], :search + + can [:admin, :show], :account end def add_product_management_abilities(user) diff --git a/config/routes.rb b/config/routes.rb index 20d01b18c0..f2ae6ea78f 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -110,6 +110,8 @@ Openfoodnetwork::Application.routes.draw do get :start_job end end + + resource :account, only: [:show], controller: 'account' end namespace :api do diff --git a/spec/models/spree/ability_spec.rb b/spec/models/spree/ability_spec.rb index a8fe68ec4b..6b60707775 100644 --- a/spec/models/spree/ability_spec.rb +++ b/spec/models/spree/ability_spec.rb @@ -477,6 +477,10 @@ module Spree user end + it 'should have the ability to view the admin account page' do + should have_ability([:admin, :show], for: :account) + 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) end @@ -505,6 +509,10 @@ module Spree it 'should have the ability to welcome and register enterprises that I own' do should have_ability([:welcome, :register], for: s1) end + + it 'should have the ability to view the admin account page' do + should have_ability([:admin, :show], for: :account) + end end end end