File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ require 'spec_helper'
2+
3+ if Puppet . version . to_f >= 4.5
4+ describe 'test::hash' , type : :class do
5+ describe 'accepts hashes' do
6+ [
7+ { } ,
8+ { 'one' => "two" } ,
9+ { 'wan' => 3 } ,
10+ { '001' => "helly" } ,
11+ ] . each do |value |
12+ describe value . inspect do
13+ let ( :params ) { { value : value } }
14+ it { is_expected . to compile }
15+ end
16+ end
17+ end
18+ describe 'rejects other values' do
19+ [
20+ '' ,
21+ 'one' ,
22+ '1' ,
23+ [ ] ,
24+ ] . each do |value |
25+ describe value . inspect do
26+ let ( :params ) { { value : value } }
27+ it { is_expected . to compile . and_raise_error ( /parameter 'value' expects a Stdlib::Compat::Hash/ ) }
28+ end
29+ end
30+ end
31+ end
32+ end
Original file line number Diff line number Diff line change 1+ # Class to test the Stdlib::Compat::Hash type alias
2+ class test::hash (
3+ Stdlib::Compat::Hash $value,
4+ ) {
5+
6+ notice (" Success" )
7+
8+ }
Original file line number Diff line number Diff line change 1+ # Emulate the is_hash and validate_hash functions
2+ type Stdlib::Compat::Hash = Hash[Any, Any]
You can’t perform that action at this time.
0 commit comments