lib/quby/compiler/services/definition_validator.rb in quby-compiler-0.2.1 vs lib/quby/compiler/services/definition_validator.rb in quby-compiler-0.3.1
- old
+ new
@@ -129,12 +129,12 @@
fail ArgumentError, "Flag '#{key}' has unknown hides_questions keys #{unknown_questions}"
end
def validate_flag_depends_on(questionnaire, flag)
- return if flag.depends_on.blank? || questionnaire.flags.key?(flag.depends_on)
+ return if (missing = flag.depends_on - questionnaire.flags.keys).blank?
- fail ArgumentError, "Flag #{flag.key} depends_on nonexistent flag '#{flag.depends_on}'"
+ fail ArgumentError, "Flag #{flag.key} depends_on nonexistent flag '#{missing.to_sentence}'"
end
def validate_respondent_types(questionnaire)
valid_respondent_types = Entities::Questionnaire::RESPONDENT_TYPES