mirror of
https://github.com/internetee/registry.git
synced 2025-05-20 11:19:39 +02:00
Api user active by default
This commit is contained in:
parent
c3560fd19f
commit
20fbe5eef7
2 changed files with 11 additions and 0 deletions
|
@ -17,6 +17,12 @@ class ApiUser < User
|
|||
end
|
||||
delegate :can?, :cannot?, to: :ability
|
||||
|
||||
after_initialize :set_defaults
|
||||
def set_defaults
|
||||
return unless new_record?
|
||||
self.active = true
|
||||
end
|
||||
|
||||
def registrar_typeahead
|
||||
@registrar_typeahead || registrar || nil
|
||||
end
|
||||
|
|
|
@ -20,6 +20,11 @@ describe ApiUser do
|
|||
it 'should not have any versions' do
|
||||
@api_user.versions.should == []
|
||||
end
|
||||
|
||||
it 'should be active by default' do
|
||||
@api_user.active.should == true
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
context 'with valid attributes' do
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue