Minior changes in SystemNotifications tests

This commit is contained in:
Urban Rotnik 2019-05-08 14:22:52 +02:00
parent 15cbd8864c
commit 9348886fb1
3 changed files with 7 additions and 12 deletions

View file

@ -16,15 +16,10 @@ class SystemNotification < ApplicationRecord
has_many :user_system_notifications
has_many :users, through: :user_system_notifications
validates :title, :modal_title, :modal_body, :description,
:source_created_at, :source_id, :last_time_changed_at,
validates :title, :modal_title, :modal_body, :description, :source_created_at, :source_id, :last_time_changed_at,
presence: true
validates :title, :description, :modal_title,
length: { maximum: Constants::NAME_MAX_LENGTH }
validates :modal_body,
length: { maximum: Constants::RICH_TEXT_MAX_LENGTH }
validates :title, :description, :modal_title, length: { maximum: Constants::NAME_MAX_LENGTH }
validates :modal_body, length: { maximum: Constants::RICH_TEXT_MAX_LENGTH }
def self.last_notifications(
user,

View file

@ -3,8 +3,7 @@
require 'rails_helper'
describe SystemNotification do
let(:user) { create :user }
subject(:system_notification) { build :system_notification }
let(:system_notification) { build :system_notification }
it 'is valid' do
expect(system_notification).to be_valid
@ -77,6 +76,7 @@ describe SystemNotification do
end
describe 'Methods' do
let(:user) { create :user }
let(:notifcation_one) { create :system_notification }
let(:notifcation_two) { create :system_notification, title: 'Special one' }
before do

View file

@ -3,8 +3,7 @@
require 'rails_helper'
describe UserSystemNotification do
let(:user) { create :user }
subject(:user_system_notification) { build :user_system_notification }
let(:user_system_notification) { build :user_system_notification }
it 'is valid' do
expect(user_system_notification).to be_valid
@ -16,6 +15,7 @@ describe UserSystemNotification do
end
describe 'Methods' do
let(:user) { create :user }
let(:notifcation_one) { create :system_notification }
let(:notifcation_two) { create :system_notification }
let(:notifcation_three) { create :system_notification, :show_on_login }