Sha256: 0240c3f46e65fc49cd2c585947dcb95eaeca3f3205fadfa41b3c43dc56b4788d

Contents?: true

Size: 638 Bytes

Versions: 7

Compression:

Stored size: 638 Bytes

Contents

# frozen_string_literal: true

module Spout
  module Tests
    # Tests to assure that the variable name starts with a lowercase letter
    # followed by lowercase letters, numbers, or underscores
    module VariableNameFormat
      Dir.glob('variables/**/*.json').each do |file|
        define_method("test_variable_name_format: #{file}") do
          message = 'Variable name format error. Name must start with a lowercase letter and be followed by lowercase letters, numbers, or underscores'
          assert_match(/^[a-z]\w*$/, (begin JSON.parse(File.read(file))['id'] rescue nil end), message)
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
spout-0.12.1 lib/spout/tests/variable_name_format.rb
spout-0.12.0 lib/spout/tests/variable_name_format.rb
spout-0.12.0.rc2 lib/spout/tests/variable_name_format.rb
spout-0.12.0.rc lib/spout/tests/variable_name_format.rb
spout-0.12.0.beta2 lib/spout/tests/variable_name_format.rb
spout-0.12.0.beta1 lib/spout/tests/variable_name_format.rb
spout-0.11.1 lib/spout/tests/variable_name_format.rb