2016-08-04 20:12:14 -05:00
|
|
|
require 'test_helper'
|
|
|
|
|
2016-08-07 09:36:08 -05:00
|
|
|
class QuestionAttachmentsTest < ActionDispatch::IntegrationTest
|
2016-08-04 20:12:14 -05:00
|
|
|
def setup_auth candidate
|
|
|
|
post validate_candidate_url, params: { test_id: candidate.test_hash }
|
|
|
|
end
|
|
|
|
|
|
|
|
test "should show attachments on question" do
|
|
|
|
setup_auth candidates(:dawn)
|
|
|
|
|
|
|
|
get question_path questions(:fed6)
|
|
|
|
assert_response :success
|
|
|
|
assert_select '.question-text', questions(:fed6).question
|
|
|
|
assert_select "img[src=\"#{questions(:fed6).attachment}\"]"
|
|
|
|
end
|
|
|
|
|
|
|
|
test "should show attachments on summary" do
|
|
|
|
setup_auth candidates(:dawn)
|
|
|
|
|
|
|
|
get summary_path
|
|
|
|
assert_response :success
|
|
|
|
assert_select "img[src=\"#{questions(:fed6).attachment}\"]"
|
|
|
|
end
|
|
|
|
|
2016-08-17 14:26:54 -05:00
|
|
|
test "should show attachments on review" do
|
|
|
|
user = users :reviewer
|
|
|
|
post review_auth_url, params: { auth: { email: user.email, password: 'password' } }
|
|
|
|
|
|
|
|
get review_test_path(candidates(:richard).test_hash)
|
|
|
|
assert_response :success
|
|
|
|
assert_select "img[src=\"#{questions(:fed6).attachment}\"]"
|
|
|
|
end
|
2016-08-04 20:12:14 -05:00
|
|
|
end
|