2016-09-08 10:25:33 -05:00
|
|
|
# frozen_string_literal: true
|
2016-08-03 10:46:03 -05:00
|
|
|
require 'test_helper'
|
|
|
|
|
|
|
|
class QuestionFlowTest < ActionDispatch::IntegrationTest
|
|
|
|
test "should load the first question" do
|
2016-09-14 17:05:37 -05:00
|
|
|
auth_candidate candidates(:martha)
|
2016-08-03 10:46:03 -05:00
|
|
|
|
|
|
|
get question_path
|
|
|
|
assert_response :success
|
2017-04-17 14:50:32 -05:00
|
|
|
assert_select 'h1', questions(:fed1).question
|
2016-08-03 10:46:03 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
test "should load the summary" do
|
2016-09-14 17:05:37 -05:00
|
|
|
auth_candidate candidates(:dawn)
|
2016-08-03 10:46:03 -05:00
|
|
|
|
|
|
|
get summary_path
|
|
|
|
assert_response :success
|
2017-03-20 10:57:50 -05:00
|
|
|
assert_select 'h1', 'Almost done!'
|
2016-08-03 10:46:03 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
test "can load specific question from summary" do
|
2016-09-14 17:05:37 -05:00
|
|
|
auth_candidate candidates(:dawn)
|
2016-08-03 10:46:03 -05:00
|
|
|
question = questions(:fed4)
|
|
|
|
|
|
|
|
get question_path(question.id)
|
|
|
|
assert_response :success
|
2017-04-17 14:50:32 -05:00
|
|
|
assert_select 'h1', question.question
|
2016-08-03 10:46:03 -05:00
|
|
|
end
|
2016-08-12 12:44:19 -05:00
|
|
|
|
|
|
|
test 'juan should be on summary with 80% complete' do
|
2016-09-14 17:05:37 -05:00
|
|
|
auth_candidate candidates(:juan)
|
2016-08-12 12:44:19 -05:00
|
|
|
|
|
|
|
get summary_path
|
|
|
|
assert_response :success
|
2017-03-20 10:57:50 -05:00
|
|
|
assert_select 'aside span', '80%'
|
2016-08-12 12:44:19 -05:00
|
|
|
end
|
2016-08-03 10:46:03 -05:00
|
|
|
end
|