OpenProject is the leading open source project management software.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
openproject/spec/models/role_spec.rb

43 lines
1.3 KiB

#-- copyright
# OpenProject is a project management system.
#
# Copyright (C) 2010-2013 the OpenProject Foundation (OPF)
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License version 3.
#
# See doc/COPYRIGHT.rdoc for more details.
#++
require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
describe Role do
describe "class methods" do
describe :givable do
before (:each) do
#this should not be necessary once Role (in a membership) and GlobalRole have
#a common ancestor class, e.g. Role (a new one)
@mem_role1 = Role.create :name => "mem_role", :permissions => []
@builtin_role1 = Role.new :name => "builtin_role1", :permissions => []
@builtin_role1.builtin = 3
@builtin_role1.save
@global_role1 = GlobalRole.create :name => "global_role1", :permissions => []
end
it {Role.find_all_givable.should have(1).items}
it {Role.find_all_givable[0].should eql @mem_role1}
end
end
describe "instance methods" do
before (:each) do
@role = Role.new
end
describe :setable_permissions do
before {mock_permissions_for_setable_permissions}
it {@role.setable_permissions.should eql([@perm1, @perm2])}
end
end
end