mirror of
https://github.com/internetee/registry.git
synced 2025-05-20 19:29: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
|
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
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue