2
0
Fork 0
mirror of https://github.com/inspec/inspec synced 2024-12-24 03:53:15 +00:00
inspec/test/unit/resources/yaml_test.rb

35 lines
856 B
Ruby
Raw Normal View History

2015-09-21 07:51:54 +00:00
# encoding: utf-8
require 'helper'
2015-10-26 03:04:18 +00:00
require 'inspec/resource'
2015-09-21 07:51:54 +00:00
2015-10-26 03:04:18 +00:00
describe 'Inspec::Resources::YAML' do
2015-10-27 14:41:43 +00:00
describe 'when loading a valid yaml' do
let (:resource) { load_resource('yaml', 'kitchen.yml') }
it 'gets params as a hashmap' do
_(resource.params).must_be_kind_of Hash
end
it 'retrieves nil if a param is missing' do
_(resource.params['missing']).must_be_nil
end
it 'retrieves params by name' do
_(resource.send('name')).must_equal 'vagrant'
end
it 'retrieves an array by name' do
_(resource.send('platforms')).must_equal %w{linux mac}
end
it 'doesnt resolve dot-notation names' do
_(resource.send('driver.customize.memory')).must_be_nil
end
it 'doesnt resolve symbol-notation names' do
_(resource.send(:'driver.customize.memory')).must_be_nil
end
2015-09-21 07:51:54 +00:00
end
end