Sha256: 9081a63e287ef82281335f355a878b2b4c7ad31a09c582d2ee0dd81e063aabb0
Contents?: true
Size: 794 Bytes
Versions: 28
Compression:
Stored size: 794 Bytes
Contents
module Spout module Tests module DomainFormat def assert_domain_format(item) result = begin json = JSON.parse(File.read(item)) if json.kind_of?(Array) json.empty? or json.select{|o| not o.kind_of?(Hash)}.size == 0 else false end rescue JSON::ParserError false end message = "Must be an array of choice hashes. Ex:\n[\n {\n \"value\": \"1\",\n \"display_name\": \"Option 1\",\n \"description\": \"...\"\n },\n { ... },\n ...\n]" assert result, message end Dir.glob("domains/**/*.json").each do |file| define_method("test_domain_format: "+file) do assert_domain_format file end end end end end
Version data entries
28 entries across 28 versions & 1 rubygems