mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-12-27 10:14:17 +08:00
Minior changes in SystemNotifications tests
This commit is contained in:
parent
15cbd8864c
commit
9348886fb1
3 changed files with 7 additions and 12 deletions
|
@ -16,15 +16,10 @@ class SystemNotification < ApplicationRecord
|
||||||
has_many :user_system_notifications
|
has_many :user_system_notifications
|
||||||
has_many :users, through: :user_system_notifications
|
has_many :users, through: :user_system_notifications
|
||||||
|
|
||||||
validates :title, :modal_title, :modal_body, :description,
|
validates :title, :modal_title, :modal_body, :description, :source_created_at, :source_id, :last_time_changed_at,
|
||||||
:source_created_at, :source_id, :last_time_changed_at,
|
|
||||||
presence: true
|
presence: true
|
||||||
|
validates :title, :description, :modal_title, length: { maximum: Constants::NAME_MAX_LENGTH }
|
||||||
validates :title, :description, :modal_title,
|
validates :modal_body, length: { maximum: Constants::RICH_TEXT_MAX_LENGTH }
|
||||||
length: { maximum: Constants::NAME_MAX_LENGTH }
|
|
||||||
|
|
||||||
validates :modal_body,
|
|
||||||
length: { maximum: Constants::RICH_TEXT_MAX_LENGTH }
|
|
||||||
|
|
||||||
def self.last_notifications(
|
def self.last_notifications(
|
||||||
user,
|
user,
|
||||||
|
|
|
@ -3,8 +3,7 @@
|
||||||
require 'rails_helper'
|
require 'rails_helper'
|
||||||
|
|
||||||
describe SystemNotification do
|
describe SystemNotification do
|
||||||
let(:user) { create :user }
|
let(:system_notification) { build :system_notification }
|
||||||
subject(:system_notification) { build :system_notification }
|
|
||||||
|
|
||||||
it 'is valid' do
|
it 'is valid' do
|
||||||
expect(system_notification).to be_valid
|
expect(system_notification).to be_valid
|
||||||
|
@ -77,6 +76,7 @@ describe SystemNotification do
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'Methods' do
|
describe 'Methods' do
|
||||||
|
let(:user) { create :user }
|
||||||
let(:notifcation_one) { create :system_notification }
|
let(:notifcation_one) { create :system_notification }
|
||||||
let(:notifcation_two) { create :system_notification, title: 'Special one' }
|
let(:notifcation_two) { create :system_notification, title: 'Special one' }
|
||||||
before do
|
before do
|
||||||
|
|
|
@ -3,8 +3,7 @@
|
||||||
require 'rails_helper'
|
require 'rails_helper'
|
||||||
|
|
||||||
describe UserSystemNotification do
|
describe UserSystemNotification do
|
||||||
let(:user) { create :user }
|
let(:user_system_notification) { build :user_system_notification }
|
||||||
subject(:user_system_notification) { build :user_system_notification }
|
|
||||||
|
|
||||||
it 'is valid' do
|
it 'is valid' do
|
||||||
expect(user_system_notification).to be_valid
|
expect(user_system_notification).to be_valid
|
||||||
|
@ -16,6 +15,7 @@ describe UserSystemNotification do
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'Methods' do
|
describe 'Methods' do
|
||||||
|
let(:user) { create :user }
|
||||||
let(:notifcation_one) { create :system_notification }
|
let(:notifcation_one) { create :system_notification }
|
||||||
let(:notifcation_two) { create :system_notification }
|
let(:notifcation_two) { create :system_notification }
|
||||||
let(:notifcation_three) { create :system_notification, :show_on_login }
|
let(:notifcation_three) { create :system_notification, :show_on_login }
|
||||||
|
|
Loading…
Reference in a new issue