Api user active by default

This commit is contained in:
Priit Tark 2015-02-26 11:09:22 +02:00
parent c3560fd19f
commit 20fbe5eef7
2 changed files with 11 additions and 0 deletions

View file

@ -17,6 +17,12 @@ class ApiUser < User
end end
delegate :can?, :cannot?, to: :ability delegate :can?, :cannot?, to: :ability
after_initialize :set_defaults
def set_defaults
return unless new_record?
self.active = true
end
def registrar_typeahead def registrar_typeahead
@registrar_typeahead || registrar || nil @registrar_typeahead || registrar || nil
end end

View file

@ -20,6 +20,11 @@ describe ApiUser do
it 'should not have any versions' do it 'should not have any versions' do
@api_user.versions.should == [] @api_user.versions.should == []
end end
it 'should be active by default' do
@api_user.active.should == true
end
end end
context 'with valid attributes' do context 'with valid attributes' do