Sha256: 92809b0205246003cc64a18802524a0b50fb84753bfdc0032a3c5ccbde6e5260

Contents?: true

Size: 705 Bytes

Versions: 44

Compression:

Stored size: 705 Bytes

Contents

module Spout
  module Tests
    module JsonValidation

      def assert_valid_json(item, msg = nil)
        result = begin
          !!JSON.parse(File.read(item))
        rescue JSON::ParserError => e
          error = e
          false
        end
        full_message = build_message(msg, "?", error)
        assert_block(full_message) do
          result
        end
      end

      Dir.glob("variables/**/*.json").each do |file|
        define_method("test_json: "+file) do
          assert_valid_json file
        end
      end

      Dir.glob("domains/**/*.json").each do |file|
        define_method("test_json: "+file) do
          assert_valid_json file
        end
      end

    end
  end
end

Version data entries

44 entries across 44 versions & 1 rubygems

Version Path
spout-0.8.0.beta12 lib/spout/tests/json_validation.rb
spout-0.8.0.beta11 lib/spout/tests/json_validation.rb
spout-0.8.0.beta10 lib/spout/tests/json_validation.rb
spout-0.8.0.beta9 lib/spout/tests/json_validation.rb
spout-0.8.0.beta8 lib/spout/tests/json_validation.rb
spout-0.8.0.beta7 lib/spout/tests/json_validation.rb
spout-0.8.0.beta6 lib/spout/tests/json_validation.rb
spout-0.8.0.beta5 lib/spout/tests/json_validation.rb
spout-0.8.0.beta4 lib/spout/tests/json_validation.rb
spout-0.8.0.beta3 lib/spout/tests/json_validation.rb
spout-0.8.0.beta2 lib/spout/tests/json_validation.rb
spout-0.8.0.beta1 lib/spout/tests/json_validation.rb
spout-0.7.0 lib/spout/tests/json_validation.rb
spout-0.7.0.beta3 lib/spout/tests/json_validation.rb
spout-0.7.0.beta2 lib/spout/tests/json_validation.rb
spout-0.7.0.beta1 lib/spout/tests/json_validation.rb
spout-0.6.0 lib/spout/tests/json_validation.rb
spout-0.6.0.rc2 lib/spout/tests/json_validation.rb
spout-0.6.0.rc lib/spout/tests/json_validation.rb
spout-0.6.0.beta7 lib/spout/tests/json_validation.rb