mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-28 06:15:17 +00:00
Adding basic route and controller for business model configuration
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
class Admin::BusinessModelConfigurationController < Spree::Admin::BaseController
|
||||
|
||||
end
|
||||
@@ -116,6 +116,8 @@ Openfoodnetwork::Application.routes.draw do
|
||||
end
|
||||
end
|
||||
|
||||
resource :business_model_configuration, only: [:edit]
|
||||
|
||||
resource :account, only: [:show], controller: 'account'
|
||||
end
|
||||
|
||||
|
||||
@@ -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
|
||||
Reference in New Issue
Block a user