Sha256: 7c3bcda05d837e51d7e65b11cf11309a1b92b0affa026cdfcef0de9ef615e603
Contents?: true
Size: 1.31 KB
Versions: 10
Compression:
Stored size: 1.31 KB
Contents
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') describe Hydra::AccessControlsEvaluation do describe "test_permission" do it "should automatically add logged-in users to 'registered' group" do mock_user = mock("User", :login => "logged_in_person") helper.stubs(:read_groups).returns(["registered"]) helper.stubs(:current_user).returns(nil) helper.test_permission(:read).should == false helper.stubs(:current_user).returns(mock_user) helper.test_permission(:read).should == true end end describe "editor?" do it "should return true if current_user.is_being_superuser? is true" do mock_user = mock("User", :login => "BigWig") mock_user.stubs(:is_being_superuser?).returns true helper.stubs(:current_user).returns mock_user helper.editor?.should be_true end it "should return false if the session[:user] is not logged in" do helper.stubs(:current_user).returns(nil) helper.editor?.should be_false end it "should return false if the session[:user] does not have an editor role" do mock_user = mock("User", :login=>"nobody_special") mock_user.stubs(:is_being_superuser?).returns(false) helper.stubs(:current_user).returns(mock_user) helper.editor?.should be_false end end end
Version data entries
10 entries across 10 versions & 1 rubygems