Skip to content

A platform for community discussion. Free, open, simple.

Additional spec test function added and fixed the existing

Vinoth Kannan4d842ef2d5ab
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