Sha256: 76df8ef45a68adf7b26ad5265c23ef20eabdeca79d42b91fab51a1ec9fce8adc
Contents?: true
Size: 1.48 KB
Versions: 2
Compression:
Stored size: 1.48 KB
Contents
require 'spec_helper' # This is a somewhat temporary test class to compare functionality # between the AWS, OS and new ways of defining types RSpec.describe 'Type Definitions' do aws_spec = YAML.load_file File.expand_path('../../lib/cfndsl/aws/types.yaml', __FILE__) os_spec = YAML.load_file File.expand_path('../../lib/cfndsl/os/types.yaml', __FILE__) new_spec = CfnDsl::Specification.extract_from_resource_spec! { 'AWS' => aws_spec, 'OS' => os_spec, 'New' => new_spec }.each_pair do |cloud, specdef| context cloud do resources = specdef['Resources'] types = specdef['Types'] context 'Resources' do resources.each do |name, info| it "#{name} has all property types defined" do properties = info['Properties'] properties.each_value do |type| type = type.first if type.is_a?(Array) expect(types).to have_key(type) end end end end context 'Types' do types.each do |name, type| it "#{name} has all property types defined" do type = type.first if type.is_a?(Array) if type.is_a?(String) expect(types).to have_key(type) elsif type.is_a?(Hash) type.values.flatten.each { |t| expect(types).to have_key(t) } else raise "A defined type should only be of the form String, Array or Hash, got #{type.class}" end end end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
cfndsl-0.16.2 | spec/types_definition_spec.rb |
cfndsl-0.16.1 | spec/types_definition_spec.rb |