Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require "feature_spec_helper"
- RSpec.feature "Participant completes an Interview" do
- PROJECT_ID = 94 # Interview Project
- INTERVIEW_ID = 341 # Interview Task
- INTERVIEW_TASK_LIST_ID = 109 # Blanks
- scenario "viewing the Interview" do
- sign_in_and_visit_interview
- expect(page).to have_stimuli
- expect(page).to have_continue_button
- end
- scenario "with valid data" do
- sign_in_and_visit_interview
- complete_first_question
- complete_second_question
- participant_is_redirected_to_task_list
- end
- scenario "returning to an incomplete Interview" do
- sign_in_and_visit_interview
- complete_first_question
- visit(root_path)
- visit_interview
- expect(page).to have_stimuli_for_the_second_question
- complete_second_question
- end
- def have_stimuli_for_the_second_question
- have_content("This is the second Question!")
- end
- def have_continue_button
- have_button(I18n.t("opinion.next"))
- end
- def have_stimuli
- have_content("Hi, welcome to CrowdLab!")
- end
- def complete_first_question
- click_button(I18n.t("opinion.next"))
- end
- def complete_second_question
- click_button(I18n.t("opinion.finish"))
- end
- def participant_is_redirected_to_task_list
- url = project_tasks_url(PROJECT_ID, task_list_id: INTERVIEW_TASK_LIST_ID)
- expect(current_url).to eq(url)
- end
- def sign_in_and_visit_interview
- request_as_tenant("crowdlab")
- sign_in_as_participant
- visit_interview
- end
- def visit_interview
- visit(interview_path)
- end
- def interview_path
- project_interview_path(PROJECT_ID, INTERVIEW_ID)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement