From 33aa42d74dafb5cc00206c4af28dfef3ca079ace Mon Sep 17 00:00:00 2001 From: Brandon Dunne Date: Fri, 28 Sep 2018 18:26:33 -0400 Subject: [PATCH] Merge pull request #18035 from kbrock/monitor_notifier_fix Fix Notifications None (cherry picked from commit 8489078c17dcc236541e3c3cebdf20bb2e6291c1) https://bugzilla.redhat.com/show_bug.cgi?id=1535177 --- app/models/notification_type.rb | 2 +- spec/models/notification_type_spec.rb | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/app/models/notification_type.rb b/app/models/notification_type.rb index dfe17d457e1..ffb4e97be5b 100644 --- a/app/models/notification_type.rb +++ b/app/models/notification_type.rb @@ -11,7 +11,7 @@ class NotificationType < ApplicationRecord validates :level, :inclusion => { :in => %w(success error warning info) } validates :link_to, :inclusion => { :in => %w(subject initiator cause) }, :allow_blank => true validates :audience, :inclusion => { - :in => [AUDIENCE_USER, AUDIENCE_GROUP, AUDIENCE_TENANT, AUDIENCE_GLOBAL, AUDIENCE_SUPERADMIN] + :in => [AUDIENCE_USER, AUDIENCE_GROUP, AUDIENCE_TENANT, AUDIENCE_GLOBAL, AUDIENCE_SUPERADMIN, AUDIENCE_NONE] } def subscriber_ids(subject, initiator) diff --git a/spec/models/notification_type_spec.rb b/spec/models/notification_type_spec.rb index 114d4a7b9e6..bb084d69151 100644 --- a/spec/models/notification_type_spec.rb +++ b/spec/models/notification_type_spec.rb @@ -44,4 +44,12 @@ end end end + + describe "#enabled?" do + it "detects properly" do + expect(FactoryGirl.build(:notification_type, :audience => NotificationType::AUDIENCE_USER)).to be_enabled + expect(FactoryGirl.build(:notification_type, :audience => NotificationType::AUDIENCE_NONE)).not_to be_enabled + expect(FactoryGirl.build(:notification_type, :audience => NotificationType::AUDIENCE_NONE)).to be_valid + end + end end