File tree Expand file tree Collapse file tree
spec/octocatalog-diff/tests Expand file tree Collapse file tree Original file line number Diff line number Diff line change 479479 expect { catalog . validate_references } . to raise_error ( OctocatalogDiff ::Catalog ::ReferenceValidationError , error_str )
480480 end
481481 end
482+
483+ describe '#build_resource_hash' do
484+ before ( :each ) do
485+ resource_array = [
486+ {
487+ 'type' => 'Exec' ,
488+ 'title' => 'title of the exec' ,
489+ 'file' => '/etc/puppetlabs/code/site/manifests/init.pp' ,
490+ 'line' => 6 ,
491+ 'exported' => false ,
492+ 'parameters' => {
493+ 'alias' => 'the exec' ,
494+ 'command' => '/bin/true'
495+ }
496+ }
497+ ]
498+ described_object = described_class . allocate
499+ expect ( described_object ) . to receive ( :resources ) . and_return ( resource_array )
500+ described_object . send ( :build_resource_hash )
501+ @resource_hash = described_object . instance_variable_get ( :'@resource_hash' )
502+ end
503+
504+ it 'should contain the entry for the titled resource' do
505+ expect ( @resource_hash [ 'Exec' ] [ 'title of the exec' ] ) . to be_a_kind_of ( Hash )
506+ end
507+
508+ it 'should contain the entry for the aliased resource' do
509+ expect ( @resource_hash [ 'Exec' ] [ 'the exec' ] ) . to be_a_kind_of ( Hash )
510+ end
511+ end
482512end
You can’t perform that action at this time.
0 commit comments