UX: Don't send emails for discobot notifications.

This commit is contained in:
Guo Xiang Tan
2017-06-12 16:41:39 +09:00
parent 41365f681c
commit e888369f51
13 changed files with 83 additions and 24 deletions

View File

@ -37,6 +37,9 @@ describe DiscourseNarrativeBot::NewUserNarrative do
end
it 'should create the right message' do
NotificationEmailer.enable
NotificationEmailer.expects(:process_notification).once
expect { narrative.notify_timeout(user) }.to change { Post.count }.by(1)
expect(Post.last.raw).to eq(I18n.t(

View File

@ -102,6 +102,24 @@ describe DiscourseNarrativeBot::TrackSelector do
expect(Post.last.raw).to eq(expected_raw.chomp)
end
it 'should not enqueue any user email' do
NotificationEmailer.enable
user.user_option.update!(email_always: true)
post.update!(
raw: 'show me what you can do',
reply_to_post_number: first_post.post_number
)
NotificationEmailer.expects(:process_notification).never
described_class.new(:reply, user, post_id: post.id).select
expect(Post.last.raw).to eq(I18n.t(
"discourse_narrative_bot.new_user_narrative.formatting.not_found"
))
end
end
context 'when a non regular post is created' do