2016-08-16 12:08:13 -05:00
|
|
|
class AnswerValidatable
|
|
|
|
include ActiveModel::Validations
|
|
|
|
|
|
|
|
attr_accessor :answer
|
|
|
|
attr_accessor :question
|
2016-08-23 21:54:53 -05:00
|
|
|
attr_accessor :question_id
|
2016-08-16 12:08:13 -05:00
|
|
|
|
|
|
|
validates :answer, answer_format: true
|
|
|
|
|
|
|
|
MockQuestion = Struct.new(:input_type)
|
|
|
|
|
2016-08-23 21:54:53 -05:00
|
|
|
def initialize input_type, qid = nil
|
2016-08-16 12:08:13 -05:00
|
|
|
@input_type = input_type
|
2016-08-23 21:54:53 -05:00
|
|
|
@question_id = qid
|
2016-08-16 12:08:13 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
def question
|
|
|
|
MockQuestion.new(@input_type)
|
|
|
|
end
|
|
|
|
end
|