From 186a9630b7c0520b450eff3c516023c6ab8a2427 Mon Sep 17 00:00:00 2001 From: Joe Buhlig Date: Fri, 4 Mar 2016 14:41:59 -0600 Subject: [PATCH] Added spec for topic status update event --- spec/models/topic_spec.rb | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/spec/models/topic_spec.rb b/spec/models/topic_spec.rb index 3799738ad..6d0e7074e 100644 --- a/spec/models/topic_spec.rb +++ b/spec/models/topic_spec.rb @@ -1584,4 +1584,20 @@ describe Topic do expect(topic.message_archived?(user)).to eq(true) end + + it 'will trigger :topic_status_updated' do + topic = Fabricate(:topic) + user = topic.user + user.admin = true + @topic_status_event_triggered = false + + DiscourseEvent.on(:topic_status_updated) do + @topic_status_event_triggered = true + end + + topic.update_status('closed', true, user) + topic.reload + + expect(@topic_status_event_triggered).to eq(true) + end end