skill-assessment-app/test/test_helpers/answer_validatable.rb

21 lines
381 B
Ruby
Raw Normal View History

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