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

22 lines
411 B
Ruby
Raw Permalink Normal View History

# frozen_string_literal: true
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