Sha256: 9bdb3f494b91a4f4de50f8fad68d255400aa00e88273b3b5f676ca5d734bb975

Contents?: true

Size: 642 Bytes

Versions: 33

Compression:

Stored size: 642 Bytes

Contents

module Spout
  module Tests
    module VariableTypeValidation
      VALID_VARIABLE_TYPES = ['identifier', 'choices', 'integer', 'numeric', 'string', 'text', 'date', 'time', 'file', 'datetime'].sort

      def assert_variable_type(item)
        message = "#{item} invalid variable type. Valid types: #{VALID_VARIABLE_TYPES.join(', ')}"
        assert VALID_VARIABLE_TYPES.include?(item), message
      end

      Dir.glob("variables/**/*.json").each do |file|
        define_method("test_variable_type: "+file) do
          assert_variable_type begin JSON.parse(File.read(file))["type"] rescue nil end
        end
      end

    end
  end
end

Version data entries

33 entries across 33 versions & 1 rubygems

Version Path
spout-0.11.0 lib/spout/tests/variable_type_validation.rb
spout-0.11.0.rc lib/spout/tests/variable_type_validation.rb
spout-0.11.0.beta3 lib/spout/tests/variable_type_validation.rb
spout-0.11.0.beta2 lib/spout/tests/variable_type_validation.rb
spout-0.11.0.beta1 lib/spout/tests/variable_type_validation.rb
spout-0.10.2 lib/spout/tests/variable_type_validation.rb
spout-0.10.1 lib/spout/tests/variable_type_validation.rb
spout-0.10.0 lib/spout/tests/variable_type_validation.rb
spout-0.10.0.rc3 lib/spout/tests/variable_type_validation.rb
spout-0.10.0.rc2 lib/spout/tests/variable_type_validation.rb
spout-0.10.0.rc lib/spout/tests/variable_type_validation.rb
spout-0.10.0.beta10 lib/spout/tests/variable_type_validation.rb
spout-0.10.0.beta9 lib/spout/tests/variable_type_validation.rb
spout-0.10.0.beta8 lib/spout/tests/variable_type_validation.rb
spout-0.10.0.beta7 lib/spout/tests/variable_type_validation.rb
spout-0.10.0.beta6 lib/spout/tests/variable_type_validation.rb
spout-0.10.0.beta4 lib/spout/tests/variable_type_validation.rb
spout-0.10.0.beta3 lib/spout/tests/variable_type_validation.rb
spout-0.10.0.beta2 lib/spout/tests/variable_type_validation.rb
spout-0.10.0.beta1 lib/spout/tests/variable_type_validation.rb