Skip to content

Commit

Permalink
Policy変更に伴い、テストも修正
Browse files Browse the repository at this point in the history
・app/policies/submission_answer_policy.rb
  • Loading branch information
masyuko0222 committed Jul 16, 2024
1 parent cd3cf49 commit 30188e2
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions test/system/practice/submission_answer_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 30188e2

Please sign in to comment.