Additional spec test function added and fixed the existing

This commit is contained in:
Vinoth Kannan 2018-02-21 21:47:02 +05:30
parent 776ab73a8d
commit 4d842ef2d5

View File

@ -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