Skip to content

Commit

Permalink
indexとeditのテストを追加
Browse files Browse the repository at this point in the history
  • Loading branch information
daiki0381 committed Sep 16, 2022
1 parent 636d4f5 commit 478f5a2
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
8 changes: 8 additions & 0 deletions test/fixtures/survey_questions.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
survey_question1:
question_title: "フィヨルドブートキャンプの学習を通して、どんなことを学びましたか?"
question_description: "フィヨルドブートキャンプの学習を通して、どんなことを学んだか教えてください。"
question_format: "text_area"
answer_required: false
creator: komagata
created_at: <%= Time.zone.today %>
updated_at: <%= Time.zone.today %>
24 changes: 24 additions & 0 deletions test/system/survey_questions_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,28 @@ class SurveyQuestionsTest < ApplicationSystemTestCase
assert_text "作成: #{Time.zone.today.strftime("%Y年%m月%d日(#{%w[ ][Time.zone.today.wday]})")}"
assert_text "更新: #{Time.zone.today.strftime("%Y年%m月%d日(#{%w[ ][Time.zone.today.wday]})")}"
end

test 'display a list of questions' do
visit_with_auth '/survey_questions', 'komagata'
assert_text '段落'
assert_text 'フィヨルドブートキャンプの学習を通して、どんなことを学びましたか?'
assert_text "作成: #{Time.zone.today.strftime("%Y年%m月%d日(#{%w[ ][Time.zone.today.wday]})")}"
assert_text "更新: #{Time.zone.today.strftime("%Y年%m月%d日(#{%w[ ][Time.zone.today.wday]})")}"
end

test 'edit question' do
visit_with_auth '/survey_questions', 'komagata'
assert_text '段落'
assert_text 'フィヨルドブートキャンプの学習を通して、どんなことを学びましたか?'
assert_text "作成: #{Time.zone.today.strftime("%Y年%m月%d日(#{%w[ ][Time.zone.today.wday]})")}"
assert_text "更新: #{Time.zone.today.strftime("%Y年%m月%d日(#{%w[ ][Time.zone.today.wday]})")}"
click_on '編集'
fill_in 'survey_question[question_title]', with: '一番辛かったプラクティスは何ですか?'
choose '記述式', allow_label_click: true
click_button '保存'
assert_text '記述式'
assert_text '一番辛かったプラクティスは何ですか?'
assert_text "作成: #{Time.zone.today.strftime("%Y年%m月%d日(#{%w[ ][Time.zone.today.wday]})")}"
assert_text "更新: #{Time.zone.today.strftime("%Y年%m月%d日(#{%w[ ][Time.zone.today.wday]})")}"
end
end

0 comments on commit 478f5a2

Please sign in to comment.