mirror of
https://github.com/internetee/registry.git
synced 2025-07-24 03:30:33 +02:00
35 lines
No EOL
740 B
Ruby
35 lines
No EOL
740 B
Ruby
require 'test_helper'
|
|
|
|
class NotificationTest < ActiveSupport::TestCase
|
|
setup do
|
|
@notification = notifications(:greeting)
|
|
end
|
|
|
|
def test_valid
|
|
assert @notification.valid?
|
|
end
|
|
|
|
def test_invalid_without_text
|
|
@notification.text = ''
|
|
assert @notification.invalid?
|
|
end
|
|
|
|
def test_unread_by_default
|
|
notification = Notification.new(registrar: registrars(:bestnames), text: 'test')
|
|
assert notification.unread?
|
|
|
|
notification.save!
|
|
assert notification.unread?
|
|
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
|
|
assert @notification.read?
|
|
end
|
|
end |