Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ブログ記事作成時に通知が飛ばないよう、該当部分のコードをコメントアウト #8281

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion app/controllers/articles_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@ def create
@article.user = current_user if @article.user.nil?
set_wip
if @article.save
Newspaper.publish(:create_article, { article: @article })
# Newspaper.publish(:create_article, { article: @article })
# 上のコードのコメントアウトは、以下のissueのための一時的なものなので、mergeされ次第コメントアウトを外すこと。
# https://github.com/fjordllc/bootcamp/issues/8244

redirect_to redirect_url(@article), notice: notice_message(@article)
else
render :new
Expand Down
44 changes: 23 additions & 21 deletions test/system/notification/articles_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,27 +13,29 @@ class ArticlesTest < ApplicationSystemTestCase
AbstractNotifier.delivery_mode = @delivery_mode
end

test 'the notification is sent only when the article is first published' do
visit_with_auth new_article_path, 'komagata'
fill_in('article_title', with: '通知テスト1回目')
fill_in('article_body', with: 'test')
click_on '公開する'
assert_text '記事を作成しました'

visit_with_auth notifications_path, 'hajime'
within first('.card-list-item.is-unread') do
assert_text 'komagataさんがブログに「通知テスト1回目」を投稿しました。'
end
click_link '全て既読にする'

visit_with_auth edit_article_path(@article), 'komagata'
fill_in('article_title', with: '通知テスト2回目')
click_on '更新する'

visit_with_auth notifications_path, 'hajime'
assert_no_selector '.card-list-item.is-unread'
assert_no_text 'komagataさんがブログに「通知テスト2回目」を投稿しました。'
end
# test 'the notification is sent only when the article is first published' do
# visit_with_auth new_article_path, 'komagata'
# fill_in('article_title', with: '通知テスト1回目')
# fill_in('article_body', with: 'test')
# click_on '公開する'
# assert_text '記事を作成しました'

# visit_with_auth notifications_path, 'hajime'
# within first('.card-list-item.is-unread') do
# assert_text 'komagataさんがブログに「通知テスト1回目」を投稿しました。'
# end
# click_link '全て既読にする'

# visit_with_auth edit_article_path(@article), 'komagata'
# fill_in('article_title', with: '通知テスト2回目')
# click_on '更新する'

# visit_with_auth notifications_path, 'hajime'
# assert_no_selector '.card-list-item.is-unread'
# assert_no_text 'komagataさんがブログに「通知テスト2回目」を投稿しました。'
# end
# 上のコードのコメントアウトは、以下のissueのための一時的なものなので、mergeされ次第コメントアウトを外すこと。
# https://github.com/fjordllc/bootcamp/issues/8244

test 'the notification is not sent when the article with WIP is saved' do
visit_with_auth new_article_path, 'komagata'
Expand Down