Class: Kitchen::DataMunger
- Inherits:
-
Object
- Object
- Kitchen::DataMunger
- Defined in:
- lib/kitchen/verifier/inspec.rb
Overview
monkey patch test-kitchen to get the suite information within this verifier, since test-kitchen does not allow a proper hook
Instance Method Summary collapse
-
#move_data_to!(to, root, key) ⇒ Object
TODO: remove, once github.com/test-kitchen/test-kitchen/pull/955 is merged.
-
#original_verifier_data_for ⇒ Object
save reference to olf method.
- #verifier_data_for(suite, platform) ⇒ Object
Instance Method Details
#move_data_to!(to, root, key) ⇒ Object
TODO: remove, once github.com/test-kitchen/test-kitchen/pull/955 is merged
46 47 48 49 50 51 |
# File 'lib/kitchen/verifier/inspec.rb', line 46 def move_data_to!(to, root, key) return unless root.key?(key) pdata = root.fetch(to, {}) pdata = { name: pdata } if pdata.is_a?(String) root[to] = pdata.rmerge(key => root.delete(key)) if !root.fetch(key, nil).nil? end |
#original_verifier_data_for ⇒ Object
save reference to olf method
33 |
# File 'lib/kitchen/verifier/inspec.rb', line 33 alias_method :original_verifier_data_for, :verifier_data_for |
#verifier_data_for(suite, platform) ⇒ Object
35 36 37 38 39 40 41 42 43 |
# File 'lib/kitchen/verifier/inspec.rb', line 35 def verifier_data_for(suite, platform) # filter current suite and extract `inspec_tests` and move it to verifier data.fetch(:suites, []).select { |f| f[:name] == suite }.each do |suite_data| move_data_to!(:verifier, suite_data, :inspec_tests) end # run original behaviour original_verifier_data_for(suite, platform) end |