fixes #39 making sure question attachements show up everywhere
This commit is contained in:
parent
fc784ffcb1
commit
5cac3af354
@ -22,6 +22,10 @@
|
||||
</div>
|
||||
|
||||
<div class="answer-container">
|
||||
<% if question.attachment.present? %>
|
||||
<%= image_tag question.attachment %>
|
||||
<% end %>
|
||||
|
||||
<fieldset disabled class="answer-block">
|
||||
<%= hidden_field_tag 'answer[question_id]', question.question_id %>
|
||||
<%= render partial: question.input_type, locals: {question: question, form: form} %>
|
||||
|
@ -16,6 +16,9 @@
|
||||
</div>
|
||||
|
||||
<div class="answer-container">
|
||||
<% if question.attachment.present? %>
|
||||
<%= image_tag question.attachment %>
|
||||
<% end %>
|
||||
<fieldset disabled class="answer-block">
|
||||
<%= hidden_field_tag 'answer[question_id]', question.question_id %>
|
||||
<%= render partial: "candidate/#{question.input_type}", locals: {question: question, form: form} %>
|
||||
|
36
test/integration/question_features_test.rb
Normal file
36
test/integration/question_features_test.rb
Normal file
@ -0,0 +1,36 @@
|
||||
require 'test_helper'
|
||||
|
||||
class QuestionFeatureTest < ActionDispatch::IntegrationTest
|
||||
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
|
||||
|
||||
# For some reason this test fails on review, but passes on summery /shrug
|
||||
# explore later
|
||||
#
|
||||
# test "should show attachments on review" do
|
||||
# user = users :reviewer
|
||||
# post review_auth_url, params: { auth: { email: user.email, password: 'password' } }
|
||||
#
|
||||
# get review_path(candidates(:richard).test_hash)
|
||||
# assert_response :success
|
||||
# assert_select "img[src=\"#{questions(:fed6).attachment}\"]"
|
||||
# end
|
||||
end
|
Loading…
Reference in New Issue
Block a user