start implementig tests for notification model

This commit is contained in:
zmagod 2016-10-06 11:40:01 +02:00
parent fe08022b2d
commit b1815b85a0
2 changed files with 20 additions and 7 deletions

View file

@ -1,11 +1,9 @@
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
one:
title: MyString
message: MyString
title: 'Notification one'
message: 'Message for notification one'
type_of: 1
two:
title: MyString
message: MyString
title: 'Notification two'
message: 'Message for notification two'
type_of: 1

View file

@ -1,12 +1,27 @@
require 'test_helper'
class NotificationTest < ActiveSupport::TestCase
def setup
@user = users(:john)
@notification = notificaton(:one)
@user_notification = UserNotification.new(user: @user,
notificaton: @notificaton)
end
should have_db_column(:title).of_type(:string)
should have_db_column(:message).of_type(:text)
should have_db_column(:message).of_type(:string)
should have_db_column(:type_of).of_type(:integer)
should have_db_column(:created_at).of_type(:datetime)
should have_db_column(:updated_at).of_type(:datetime)
should have_db_column(:generator_user_id)
should have_many(:user_notifications)
should have_many(:users)
should belong_to(:generator_user).class_name('User')
test '#already_seen' do
notifications = Notification.already_seen(@user)
byebug
assert notifications.eq([false])
end
end