Skip discobot mention tutorial if mentions are disabled.

This commit is contained in:
Guo Xiang Tan 2018-08-23 14:58:07 +08:00
parent f28a53db48
commit ff0979553d
2 changed files with 18 additions and 0 deletions

View File

@ -51,6 +51,7 @@ module DiscourseNarrativeBot
},
tutorial_mention: {
prerequisite: Proc.new { SiteSetting.enable_mentions },
next_state: :tutorial_formatting,
next_instructions: Proc.new { I18n.t("#{I18N_KEY}.formatting.instructions", base_uri: Discourse.base_uri) },

View File

@ -690,6 +690,23 @@ describe DiscourseNarrativeBot::NewUserNarrative do
end
end
describe 'when user mentions is disabled' do
before do
SiteSetting.enable_mentions = false
end
it 'should skip the mention tutorial step' do
post.update!(
raw: ':monkey: :fries:'
)
narrative.expects(:enqueue_timeout_job).with(user)
narrative.input(:reply, user, post: post)
expect(narrative.get_data(user)[:state].to_sym).to eq(:tutorial_formatting)
end
end
it 'should create the right reply' do
post.update!(
raw: ':monkey: :fries:'