diff --git a/test/system/practice/submission_answer_test.rb b/test/system/practice/submission_answer_test.rb index 8beed7dffe1..9452f393558 100644 --- a/test/system/practice/submission_answer_test.rb +++ b/test/system/practice/submission_answer_test.rb @@ -7,18 +7,21 @@ class Practice::SubmissionAnswerTest < ApplicationSystemTestCase @practice = practices(:practice1) end - test 'student passed practice can show submission answer' do - visit_with_auth practice_path(@practice), 'kimura' - assert find_button('修了')[:disabled] - visit practice_submission_answer_path(@practice) + test 'student passed practice and product can show submission answer' do + user = User.find_by(login_name: 'kimura') + visit_with_auth practice_path(@practice), user.login_name + assert @practice.product(user).checked? + assert find_button('修了', disabled: true) + click_on '模範解答' assert_text '「OS X Mountain Lionをクリーンインストールする」の模範解答' assert_text 'description...' end - test 'student not passed practice can not show submission answer' do - visit_with_auth practice_path(@practice), 'kimura' - click_on '未着手' - assert find_button('未着手')[:disabled] + test 'student not passed practice and product can not show submission answer' do + user = User.find_by(login_name: 'kensyu') + visit_with_auth practice_path(@practice), user.login_name + assert_not @practice.product(user).checked? + assert find_button('未着手', disabled: true) visit practice_submission_answer_path(@practice) assert_text 'プラクティスを修了するまで模範解答は見れません。' end