Class: RSpecPuppetUtils::HieraData::Validator
- Inherits:
-
Object
- Object
- RSpecPuppetUtils::HieraData::Validator
- Defined in:
- lib/rspec_puppet_utils/hieradata/validator.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#load_errors ⇒ Object
readonly
Returns the value of attribute load_errors.
Instance Method Summary collapse
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
6 7 8 |
# File 'lib/rspec_puppet_utils/hieradata/validator.rb', line 6 def data @data end |
#load_errors ⇒ Object (readonly)
Returns the value of attribute load_errors.
6 7 8 |
# File 'lib/rspec_puppet_utils/hieradata/validator.rb', line 6 def load_errors @load_errors end |
Instance Method Details
#validate(key, required_files = [], &block) ⇒ Object
8 9 10 11 12 13 14 15 16 |
# File 'lib/rspec_puppet_utils/hieradata/validator.rb', line 8 def validate(key, required_files = [], &block) pre_checks(required_files) @found = false @data.keys.each do |file| validate_file file, key, required_files, &block end raise ValidationError, "No match for #{key.inspect} was not found in any files" unless @found raise ValidationError, "No match for #{key.inspect} was not found in: #{required_files.join ', '}" unless required_files.empty? end |