Adding basic routing to display customer index page

This commit is contained in:
Rob Harrington
2015-05-02 19:51:54 +10:00
parent 57dbc33a7b
commit 37ff61d663
5 changed files with 17 additions and 0 deletions

View File

@@ -0,0 +1,4 @@
module Admin
class CustomersController < ResourceController
end
end

View File

@@ -185,6 +185,8 @@ class AbilityDecorator
# Reports page
can [:admin, :index, :customers, :group_buys, :bulk_coop, :sales_tax, :payments, :orders_and_distributors, :orders_and_fulfillment, :products_and_inventory, :order_cycle_management], :report
can [:admin, :index], Customer
end

View File

@@ -0,0 +1 @@
Customers

View File

@@ -79,6 +79,8 @@ Openfoodnetwork::Application.routes.draw do
resources :variant_overrides do
post :bulk_update, on: :collection
end
resources :customers, only: [:index]
end
namespace :api do

View File

@@ -220,6 +220,10 @@ module Spree
should_not have_ability([:sales_total, :group_buys, :payments, :orders_and_distributors, :users_and_enterprises], for: :report)
end
it "should not be able to list customers" do
should_not have_ability([:admin, :index], for: Customer)
end
describe "order_cycles abilities" do
context "where the enterprise is not in an order_cycle" do
let!(:order_cycle) { create(:simple_order_cycle) }
@@ -407,6 +411,10 @@ module Spree
should_not have_ability([:sales_total, :users_and_enterprises], for: :report)
end
it "should be able to list customers" do
should have_ability([:admin, :index], for: Customer)
end
context "for a given order_cycle" do
let!(:order_cycle) { create(:simple_order_cycle) }
let!(:exchange){ create(:exchange, incoming: false, order_cycle: order_cycle, receiver: d1, sender: order_cycle.coordinator) }