Sha256: bc5a368de7297eb046546fcf9e15c07f715107347edc8c81ed04135c91a444d7
Contents?: true
Size: 1.32 KB
Versions: 5
Compression:
Stored size: 1.32 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.code.should eq("403") response.should render_template('layouts/admin/error_page') end end end
Version data entries
5 entries across 5 versions & 1 rubygems