Sha256: 443f191a9eb0d6a716a49e336e16bd7f3650fc6bc659daaaacb5e3bdae7baeba
Contents?: true
Size: 1.05 KB
Versions: 13
Compression:
Stored size: 1.05 KB
Contents
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') describe UserSessionsController do before(:each) do @user = mock("User") @user.stubs(:can_be_superuser?).returns true @user2 = mock("User") @user2.stubs(:can_be_superuser?).returns false end it "should allow for toggling on and off session[:superuser_mode]" do controller.stubs(:current_user).returns(@user) request.env["HTTP_REFERER"] = "" get :superuser session[:superuser_mode].should be_true get :superuser session[:superuser_mode].should be_nil end it "should not allow superuser_mode to be set in session if current_user is not a superuser" do controller.stubs(:current_user).returns(@user2) request.env["HTTP_REFERER"] = "" get :superuser session[:superuser_mode].should be_nil end it "should redirect to the referer" do controller.stubs(:current_user).returns(@user) request.env["HTTP_REFERER"] = hydra_file_assets_path get :superuser response.should redirect_to(hydra_file_assets_path) end end
Version data entries
13 entries across 13 versions & 1 rubygems