From 4d842ef2d5ab0641128b04f544db36eac8838886 Mon Sep 17 00:00:00 2001 From: Vinoth Kannan Date: Wed, 21 Feb 2018 21:47:02 +0530 Subject: [PATCH] Additional spec test function added and fixed the existing --- spec/serializers/topic_view_serializer_spec.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/spec/serializers/topic_view_serializer_spec.rb b/spec/serializers/topic_view_serializer_spec.rb index 90d3e7a5fc4..098f7f89d73 100644 --- a/spec/serializers/topic_view_serializer_spec.rb +++ b/spec/serializers/topic_view_serializer_spec.rb @@ -80,6 +80,7 @@ describe TopicViewSerializer do describe 'when tags added to private message topics' do before do SiteSetting.tagging_enabled = true + SiteSetting.allow_staff_to_tag_in_pm = true end it "should not include the tag for normal users" do @@ -94,5 +95,15 @@ describe TopicViewSerializer do json = serialize_topic(pm, Fabricate(:admin)) expect(json[:tags]).to eq([tag.name]) end + + it "should not include the tag if pm tags disabled" do + SiteSetting.allow_staff_to_tag_in_pm = false + + json = serialize_topic(pm, moderator) + expect(json[:tags]).to eq(nil) + + json = serialize_topic(pm, Fabricate(:admin)) + expect(json[:tags]).to eq(nil) + end end end