From 99deb598bbd3542961e178bacccff43c3cee5742 Mon Sep 17 00:00:00 2001 From: Andrew Brown Date: Sun, 14 Jan 2018 09:52:15 -0600 Subject: [PATCH] update admin panel tests --- spec/controllers/admin_controller_spec.rb | 47 +++++------------------ 1 file changed, 10 insertions(+), 37 deletions(-) diff --git a/spec/controllers/admin_controller_spec.rb b/spec/controllers/admin_controller_spec.rb index e9caa8b17..67adbcb54 100644 --- a/spec/controllers/admin_controller_spec.rb +++ b/spec/controllers/admin_controller_spec.rb @@ -2,9 +2,10 @@ require 'support/devise' RSpec.describe AdminController, type: :controller do - describe 'logged in user' do + describe 'admin user' do before do user = create(:user) + user.update(site_administrator: true) sign_in user end @@ -12,25 +13,17 @@ before { get :dashboard } it { is_expected.to respond_with(200) } end + end - describe 'GET #universes' do - before { get :universes } - it { is_expected.to respond_with(200) } - end - - describe 'GET #characters' do - before { get :characters } - it { is_expected.to respond_with(200) } - end - - describe 'GET #locations' do - before { get :locations } - it { is_expected.to respond_with(200) } + describe 'non-admin user' do + before do + user = create(:user) + sign_in user end - describe 'GET #items' do - before { get :items } - it { is_expected.to respond_with(200) } + describe 'GET #dashboard' do + before { get :dashboard } + it { is_expected.to respond_with(302) } end end @@ -39,25 +32,5 @@ before { get :dashboard } it { is_expected.to respond_with(302) } end - - describe 'GET #universes' do - before { get :universes } - it { is_expected.to respond_with(302) } - end - - describe 'GET #characters' do - before { get :characters } - it { is_expected.to respond_with(302) } - end - - describe 'GET #locations' do - before { get :locations } - it { is_expected.to respond_with(302) } - end - - describe 'GET #items' do - before { get :items } - it { is_expected.to respond_with(302) } - end end end