Merge pull request #865 from Ana06/master
Name attribute in registration email not set
This commit is contained in:
commit
66e17d5ac5
2 changed files with 11 additions and 0 deletions
|
|
@ -53,6 +53,10 @@ class User < ActiveRecord::Base
|
||||||
},
|
},
|
||||||
presence: true
|
presence: true
|
||||||
|
|
||||||
|
def name
|
||||||
|
self[:name] || username
|
||||||
|
end
|
||||||
|
|
||||||
def subscribed? conference
|
def subscribed? conference
|
||||||
self.subscriptions.find_by(conference_id: conference.id).present?
|
self.subscriptions.find_by(conference_id: conference.id).present?
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,13 @@ describe User do
|
||||||
expect(another_user.roles[1]).to eq(cfp_role)
|
expect(another_user.roles[1]).to eq(cfp_role)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe '#name' do
|
||||||
|
it 'returns the username as name if there is not name' do
|
||||||
|
user = create(:user, name: nil)
|
||||||
|
expect(user.name).to eq(user.username)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
describe '#has_role?' do
|
describe '#has_role?' do
|
||||||
describe 'when user has a role' do
|
describe 'when user has a role' do
|
||||||
it 'returns true when the user has the role' do
|
it 'returns true when the user has the role' do
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue