Sha256: c8dc801b3d6429955873f23d0f32526d00346dd86d3a79b0a1948adeb56ea09f
Contents?: true
Size: 1.19 KB
Versions: 77
Compression:
Stored size: 1.19 KB
Contents
require 'spec_helper' describe RoleMapper do it "should define the 4 roles" do RoleMapper.role_names.sort.should == %w(admin_policy_object_editor archivist donor patron researcher) end it "should quer[iy]able for roles for a given user" do RoleMapper.roles('leland_himself@example.com').sort.should == ['archivist', 'donor', 'patron'] RoleMapper.roles('archivist2@example.com').should == ['archivist'] end it "should not change it's response when it's called repeatedly" do u = User.new(:uid=>'leland_himself@example.com') u.stub(:new_record?).and_return(false) RoleMapper.roles(u).sort.should == ['archivist', 'donor', 'patron', "registered"] RoleMapper.roles(u).sort.should == ['archivist', 'donor', 'patron', "registered"] end it "should return an empty array if there are no roles" do RoleMapper.roles('zeus@olympus.mt').empty?.should == true end it "should know who is what" do RoleMapper.whois('archivist').sort.should == %w(archivist1@example.com archivist2@example.com leland_himself@example.com) RoleMapper.whois('salesman').empty?.should == true RoleMapper.whois('admin_policy_object_editor').sort.should == %w(archivist1@example.com) end end
Version data entries
77 entries across 77 versions & 1 rubygems