Revision f4459c11
Added by David Davis about 8 years ago
test/unit/user_test.rb | ||
---|---|---|
|
||
test "user with create permissions should be able to create" do
|
||
setup_user "create"
|
||
record = User.new :login => "dummy", :mail => "j@j.com", :auth_source_id => AuthSourceInternal.first.id
|
||
record = User.new :login => "dummy", :mail => "j@j.com", :auth_source_id => AuthSourceInternal.first.id
|
||
record.password_hash = "asd"
|
||
assert record.save
|
||
assert record.valid?
|
||
... | ... | |
|
||
test "user cannot escalate his own roles" do
|
||
setup_user "edit"
|
||
extra_role = Role.where(:name => "foobar").first_or_create
|
||
extra_role = Role.where(:name => "foobar").first_or_create
|
||
record = User.current
|
||
record.role_ids = record.role_ids + [extra_role.id]
|
||
refute record.save
|
Also available in: Unified diff
Refs #3809 - Turning on some rubocop cops