diff --git a/app/views/notifications/_notification.html.erb b/app/views/notifications/_notification.html.erb index 34f1b96b1..5034d29a2 100644 --- a/app/views/notifications/_notification.html.erb +++ b/app/views/notifications/_notification.html.erb @@ -1,5 +1,5 @@
  • - <% if notification.try(:notifiable_available?) %> + <% if notification.notifiable.try(:notifiable_available?) %> <% locals = { notification: notification, timestamp: notification.timestamp, title: notification.notifiable_title, diff --git a/spec/features/notifications_spec.rb b/spec/features/notifications_spec.rb index f8e77ac0d..482d38b5a 100644 --- a/spec/features/notifications_spec.rb +++ b/spec/features/notifications_spec.rb @@ -128,6 +128,14 @@ feature "Notifications" do expect(page).to_not have_css("#notifications") end + scenario "Notification's notifiable model no longer includes Notifiable module" do + create(:notification, notifiable: create(:spending_proposal), user: user) + create(:notification, notifiable: create(:poll_question), user: user) + + click_notifications_icon + expect(page).to have_content('This resource is not available anymore.', count: 2) + end + context "Admin Notifications" do let(:admin_notification) do create(:admin_notification, title: 'Notification title',