Fix build.
This commit is contained in:
parent
3bc8b6c2f0
commit
b18439a1e2
|
@ -344,7 +344,7 @@ class User < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def read_first_notification?
|
||||
notifications.order(created_at: :asc).first.read
|
||||
notifications.order(created_at: :asc).first&.read || false
|
||||
end
|
||||
|
||||
def publish_notifications_state
|
||||
|
|
|
@ -1336,5 +1336,11 @@ describe User do
|
|||
expect(user.read_first_notification?).to eq(true)
|
||||
end
|
||||
end
|
||||
|
||||
describe 'when user does not have any notifications' do
|
||||
it 'should return the right value' do
|
||||
expect(user.read_first_notification?).to eq(false)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue