Sha256: c764b3121db9a98b3f6d77e89e7b8c5c9a4eb182c084a676d95d63573ec0588f
Contents?: true
Size: 869 Bytes
Versions: 3
Compression:
Stored size: 869 Bytes
Contents
# frozen_string_literal: true module Spout module Tests module FormExistenceValidation def assert_form_existence(item) form_names = Dir.glob("forms/**/*.json").collect{|file| file.split("/").last.to_s.downcase.split(".json").first} result = begin (form_names | JSON.parse(File.read(item, encoding: "utf-8"))["forms"]).size == form_names.size rescue JSON::ParserError false end message = "One or more forms referenced by #{item} does not exist." assert result, message end Dir.glob("variables/**/*.json").each do |file| if (not [nil, ""].include?(JSON.parse(File.read(file, encoding: "utf-8"))["forms"]) rescue false) define_method("test_form_exists: "+file) do assert_form_existence file end end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
spout-1.0.0 | lib/spout/tests/form_existence_validation.rb |
spout-1.0.0.beta3 | lib/spout/tests/form_existence_validation.rb |
spout-1.0.0.beta2 | lib/spout/tests/form_existence_validation.rb |