From b0a873316fb3476d4e574b97a1c2e4d06bc12ea4 Mon Sep 17 00:00:00 2001 From: Mac Siri Date: Thu, 5 Mar 2020 12:30:26 -0500 Subject: [PATCH] Fix missing thumbs down image (#6151) --- app/labor/reaction_image.rb | 3 ++- spec/factories/reactions.rb | 6 ++++++ spec/requests/notifications_spec.rb | 12 ++++++++++++ 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/app/labor/reaction_image.rb b/app/labor/reaction_image.rb index 80b57a95e..203ebad20 100644 --- a/app/labor/reaction_image.rb +++ b/app/labor/reaction_image.rb @@ -11,7 +11,8 @@ class ReactionImage "unicorn" => "emoji/emoji-one-unicorn.png", "hands" => "emoji/emoji-one-hands.png", "thinking" => "emoji/emoji-one-thinking.png", - "readinglist" => "emoji/emoji-one-bookmark.png" + "readinglist" => "emoji/emoji-one-bookmark.png", + "thumbsdown" => "emoji/emoji-one-thumbs-down.png" }.freeze images[category] end diff --git a/spec/factories/reactions.rb b/spec/factories/reactions.rb index bbf2799de..705eeb9d3 100644 --- a/spec/factories/reactions.rb +++ b/spec/factories/reactions.rb @@ -10,4 +10,10 @@ FactoryBot.define do association :reactable, factory: :article category { "readinglist" } end + + factory :thumbsdown_reaction, class: "Reaction" do + user + association :reactable, factory: :article + category { "thumbsdown" } + end end diff --git a/spec/requests/notifications_spec.rb b/spec/requests/notifications_spec.rb index c62b5cdbd..c09c66b0e 100644 --- a/spec/requests/notifications_spec.rb +++ b/spec/requests/notifications_spec.rb @@ -579,6 +579,18 @@ RSpec.describe "NotificationsIndex", type: :request do end end + context "when user is trusted" do + let(:user) { create(:user, :trusted) } + let(:reaction) { create(:thumbsdown_reaction, user: user) } + + it "allow sees thumbsdown category" do + sign_in user + Notification.send_reaction_notification_without_delay(reaction, user) + get "/notifications" + expect(response.body).to include("Notifications") + end + end + context "when a user has a new welcome notification" do # TODO: [@thepracticaldev/delightful] Only test against type_of Welcome once Onbarding notifications have been removed. let(:active_broadcast) { create(:broadcast, :onboarding, :active) }