Class: Pangea::Testing::SpecGenerator
- Defined in:
- lib/pangea/testing/spec_generator.rb
Overview
Auto-generates RSpec synthesis specs from resource metadata.
Usage:
generator = SpecGenerator.new(
provider_module: 'Pangea::Resources::AWS',
resource_type: 'aws_iam_instance_profile',
attributes_class: 'Pangea::Resources::AWS::Types::IamInstanceProfileAttributes',
required_attributes: { name: 'test-profile', role: 'test-role' },
optional_attributes: { path: '/custom/', tags: { Env: 'test' } },
expected_outputs: [:id, :arn, :name, :unique_id],
mutually_exclusive: [[:name, :name_prefix]],
terraform_ref_fields: [:role, :name],
supports_tags: true,
)
puts generator.generate
Constant Summary collapse
- HEADER =
<<~RUBY.freeze # frozen_string_literal: true # Auto-generated by Pangea::Testing::SpecGenerator # Regenerate with: pangea-core spec-gen or forge pangea-spec-gen require 'spec_helper' RUBY
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
Instance Method Summary collapse
- #generate ⇒ Object
-
#initialize(**config) ⇒ SpecGenerator
constructor
A new instance of SpecGenerator.
Constructor Details
#initialize(**config) ⇒ SpecGenerator
Returns a new instance of SpecGenerator.
32 33 34 35 |
# File 'lib/pangea/testing/spec_generator.rb', line 32 def initialize(**config) @config = config validate_config! end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
30 31 32 |
# File 'lib/pangea/testing/spec_generator.rb', line 30 def config @config end |