skill-assessment-app/test/test_helpers/answer_validatable.rb
2016-08-23 21:54:53 -05:00

21 lines
381 B
Ruby

class AnswerValidatable
include ActiveModel::Validations
attr_accessor :answer
attr_accessor :question
attr_accessor :question_id
validates :answer, answer_format: true
MockQuestion = Struct.new(:input_type)
def initialize input_type, qid = nil
@input_type = input_type
@question_id = qid
end
def question
MockQuestion.new(@input_type)
end
end