Sha256: edca22e4f8ca46aa1bee3ef80d8f8c36cad60e6eb42fed64542c7bd0abaaa058
Contents?: true
Size: 1.27 KB
Versions: 11
Compression:
Stored size: 1.27 KB
Contents
require 'spec_helper' describe Admin::ApplicationController do before :each do activate_authlogic @user = FactoryGirl.create(:spud_user) @role = FactoryGirl.create(:spud_role) @session = SpudUserSession.create(@user) end describe :require_user do controller(Admin::ApplicationController) do def index render :nothing => true end end it "should respond successfully if the current user is a super admin" do @user.update_attribute(:super_admin, true) get :index response.should be_success end it "should respond successfully if the current user has admin permissions" do @role.permission_tags = ['admin.users.full_access'] @role.save() @user.role = @role @user.save() get :index response.should be_success end it "should redirect to the login if the current user is not logged in" do @session.destroy get :index response.should redirect_to(admin_login_path) end it "should redirect to the root for a user without administrative priviledges" do @user.super_admin = false @user.role = nil @user.save get :index response.should redirect_to(root_url) end end end
Version data entries
11 entries across 11 versions & 1 rubygems