From 9e8b62552804a0e3c4865a0b2376f82ccf9ab223 Mon Sep 17 00:00:00 2001 From: Norifumi Ogawa Date: Tue, 12 Apr 2022 13:07:11 +0900 Subject: [PATCH 1/2] =?UTF-8?q?WIP=E3=81=AE=E8=B3=AA=E5=95=8F=E3=82=92?= =?UTF-8?q?=E6=9C=AA=E8=A7=A3=E6=B1=BA=E3=81=AB=E8=A1=A8=E7=A4=BA=E3=81=97?= =?UTF-8?q?=E3=81=AA=E3=81=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/api/questions_controller.rb | 2 +- app/controllers/practices/questions_controller.rb | 2 +- test/system/practice/questions_test.rb | 10 ++++++++++ test/system/questions_test.rb | 9 +++++++-- 4 files changed, 19 insertions(+), 4 deletions(-) diff --git a/app/controllers/api/questions_controller.rb b/app/controllers/api/questions_controller.rb index b7be2c6720b..8e646e03861 100644 --- a/app/controllers/api/questions_controller.rb +++ b/app/controllers/api/questions_controller.rb @@ -11,7 +11,7 @@ def index elsif params[:all].present? Question.all else - Question.not_solved + Question.not_solved.not_wip end questions = params[:practice_id].present? ? questions.where(practice_id: params[:practice_id]) : questions questions = params[:user_id].present? ? Question.where(user_id: params[:user_id]) : questions diff --git a/app/controllers/practices/questions_controller.rb b/app/controllers/practices/questions_controller.rb index 8b670e58b5e..32f586be3ce 100644 --- a/app/controllers/practices/questions_controller.rb +++ b/app/controllers/practices/questions_controller.rb @@ -9,7 +9,7 @@ def index if params[:solved].present? @practice.questions.solved elsif params[:not_solved].present? - @practice.questions.not_solved + @practice.questions.not_solved.not_wip else @practice.questions end diff --git a/test/system/practice/questions_test.rb b/test/system/practice/questions_test.rb index 56dc1c79ef8..68a965772f7 100644 --- a/test/system/practice/questions_test.rb +++ b/test/system/practice/questions_test.rb @@ -7,4 +7,14 @@ class Practice::QuestionsTest < ApplicationSystemTestCase visit_with_auth "/practices/#{practices(:practice1).id}/questions", 'hatsuno' assert_equal 'OS X Mountain Lionをクリーンインストールする | FJORD BOOT CAMP(フィヨルドブートキャンプ)', title end + + test 'show a WIP question on the all questions list ' do + visit_with_auth "/practices/#{practices(:practice1).id}/questions", 'hatsuno' + assert_text 'wipテスト用の質問(wip中)' + end + + test 'not show a WIP question on the unsolved questions list ' do + visit_with_auth "/practices/#{practices(:practice1).id}/questions?not_solved=true", 'hatsuno' + assert_no_text 'wipテスト用の質問(wip中)' + end end diff --git a/test/system/questions_test.rb b/test/system/questions_test.rb index 05ab86d98ef..6f59c5288af 100644 --- a/test/system/questions_test.rb +++ b/test/system/questions_test.rb @@ -293,8 +293,8 @@ class QuestionsTest < ApplicationSystemTestCase assert_selector '.thread-header-title__label.is-wip', text: 'WIP' end - test 'show a WIP question on the Q&A list page' do - visit_with_auth questions_path, 'kimura' + test 'show a WIP question on the All Q&A list page' do + visit_with_auth questions_path(all: 'true'), 'kimura' assert_text 'wipテスト用の質問(wip中)' element = all('.thread-list-item').find { |component| component.has_text?('wipテスト用の質問(wip中)') } within element do @@ -302,6 +302,11 @@ class QuestionsTest < ApplicationSystemTestCase end end + test 'not show a WIP question on the unsolved Q&A list page' do + visit_with_auth questions_path, 'kimura' + assert_no_text 'wipテスト用の質問(wip中)' + end + test "visit user profile page when clicked on user's name on question" do visit_with_auth questions_path, 'kimura' assert_text '質問のタブの作り方' From 7c6f491f0ad38d5b0ddba21d21e737a94a504714 Mon Sep 17 00:00:00 2001 From: Norifumi Ogawa Date: Wed, 13 Apr 2022 18:25:27 +0900 Subject: [PATCH 2/2] =?UTF-8?q?=E3=80=8C=E3=80=9C=E3=81=8C=E8=A1=A8?= =?UTF-8?q?=E7=A4=BA=E3=81=95=E3=82=8C=E3=81=AA=E3=81=84=E3=80=8D=E3=83=86?= =?UTF-8?q?=E3=82=B9=E3=83=88=E3=81=AE=E6=94=B9=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/system/practice/questions_test.rb | 1 + test/system/questions_test.rb | 1 + 2 files changed, 2 insertions(+) diff --git a/test/system/practice/questions_test.rb b/test/system/practice/questions_test.rb index 68a965772f7..4031d59ca8f 100644 --- a/test/system/practice/questions_test.rb +++ b/test/system/practice/questions_test.rb @@ -16,5 +16,6 @@ class Practice::QuestionsTest < ApplicationSystemTestCase test 'not show a WIP question on the unsolved questions list ' do visit_with_auth "/practices/#{practices(:practice1).id}/questions?not_solved=true", 'hatsuno' assert_no_text 'wipテスト用の質問(wip中)' + assert_selector('a.tab-nav__item-link.is-active', text: '未解決') end end diff --git a/test/system/questions_test.rb b/test/system/questions_test.rb index 6f59c5288af..27d9435c0af 100644 --- a/test/system/questions_test.rb +++ b/test/system/questions_test.rb @@ -305,6 +305,7 @@ class QuestionsTest < ApplicationSystemTestCase test 'not show a WIP question on the unsolved Q&A list page' do visit_with_auth questions_path, 'kimura' assert_no_text 'wipテスト用の質問(wip中)' + assert_text '未解決の質問一覧' end test "visit user profile page when clicked on user's name on question" do