validates input_options based on input type

This commit is contained in:
Mark Moser
2016-08-22 11:49:02 -05:00
parent 404555f674
commit bdec83b3b6
5 changed files with 89 additions and 7 deletions

View File

@ -1,7 +1,14 @@
require 'test_helper'
class QuestionTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
test 'should compact arrays for input_options' do
question = Question.new(quiz_id: quizzes(:fed).to_i,
question: 'foo',
category: 'bar',
input_type: 'radio',
input_options: ['one', 'two', '', ' ', nil])
question.validate
assert_equal 2, question.input_options.count
end
end