Adding basic route and controller for business model configuration

This commit is contained in:
Rob Harrington
2015-10-14 10:30:22 +11:00
parent cc4f9dd09b
commit e20b06bb97
3 changed files with 31 additions and 0 deletions

View File

@@ -0,0 +1,3 @@
class Admin::BusinessModelConfigurationController < Spree::Admin::BaseController
end

View File

@@ -116,6 +116,8 @@ Openfoodnetwork::Application.routes.draw do
end
end
resource :business_model_configuration, only: [:edit]
resource :account, only: [:show], controller: 'account'
end

View File

@@ -0,0 +1,26 @@
require 'spec_helper'
describe Admin::AccountsAndBillingSettingsController, type: :controller do
let(:user) { create(:user) }
let(:admin) { create(:admin_user) }
describe "edit" do
context "as an enterprise user" do
before { allow(controller).to receive(:spree_current_user) { user } }
it "does not allow access" do
spree_get :edit
expect(response).to redirect_to spree.unauthorized_path
end
end
context "as super admin" do
before { allow(controller).to receive(:spree_current_user) { admin } }
it "allows access" do
spree_get :edit
expect(response).to_not redirect_to spree.unauthorized_path
end
end
end
end