Add tests

This commit is contained in:
Artur Beljajev 2018-08-24 14:10:16 +03:00
parent cc0a6c229f
commit 9d74cd5673
2 changed files with 21 additions and 2 deletions

View file

@ -19,6 +19,19 @@ class NotificationTest < ActiveSupport::TestCase
assert @notification.invalid?
end
def test_unread_by_default
notification = Notification.new(registrar: registrars(:bestnames), text: 'test')
assert_not notification.read?
notification.save!
assert_not notification.read?
end
def test_honor_given_read_state
notification = Notification.new(read: true)
assert notification.read?
end
def test_mark_as_read
@notification.mark_as_read
@notification.reload