fixed attachment saving bug

This commit is contained in:
Mark Moser 2016-11-16 18:44:18 -06:00
parent 41f3d3aed1
commit 9d12b694ce
3 changed files with 14 additions and 2 deletions

View File

@ -62,7 +62,7 @@ module Admin
def question_params def question_params
params.require(:question).permit( params.require(:question).permit(
:quiz_id, :question, :category, :input_type, :sort, :active, :input_options, :quiz_id, :question, :category, :attachment, :input_type, :sort, :active, :input_options,
multi_choice: [], live_code: [:later, :html, :css, :js, :text] multi_choice: [], live_code: [:later, :html, :css, :js, :text]
) )
end end

View File

@ -67,6 +67,18 @@ module Admin
assert_select 'p', 'foo bar baz' assert_select 'p', 'foo bar baz'
end end
test "should post attachment" do
question = questions(:fed1)
post admin_update_question_url(question.to_i), params: { question:
{ quiz_id: quizzes(:fed).to_i, attachment: 'https://dev.perficientdigital.com/logo.png' } }
assert_redirected_to admin_question_path(question.to_i)
get admin_question_path question.to_i
assert_select 'img' do
assert_select "[src=?]", "https://dev.perficientdigital.com/logo.png"
end
end
test "should fail to update question" do test "should fail to update question" do
question = questions(:fed9) question = questions(:fed9)
post admin_update_question_url(question.to_i), params: { question: { question: nil } } post admin_update_question_url(question.to_i), params: { question: { question: nil } }

View File

@ -68,4 +68,4 @@ juan: # Juan has chosen "finish later" for live coders
quiz: fed quiz: fed
completed: false completed: false
reminded: true reminded: true
test_hash: <%= CryptSerializer.dump 'qKQo0l4dyol test_hash: qKQo0l4dyol