092474b66cb809face9cf76334147912b02b2d21
[mirror/dsa-puppet.git] / 3rdparty / modules / stdlib / spec / functions / hash_spec.rb
1 require 'spec_helper'
2
3 describe 'hash' do
4   it { is_expected.not_to eq(nil) }
5   it { is_expected.to run.with_params().and_raise_error(Puppet::ParseError, /wrong number of arguments/i) }
6   it {
7     pending("Current implementation ignores parameters after the first.")
8     is_expected.to run.with_params([], 'two').and_raise_error(Puppet::ParseError, /wrong number of arguments/i)
9   }
10   it { is_expected.to run.with_params(['one']).and_raise_error(Puppet::ParseError, /Unable to compute/) }
11   it { is_expected.to run.with_params([]).and_return({}) }
12   it { is_expected.to run.with_params(['key1', 'value1']).and_return({ 'key1' => 'value1' }) }
13   it { is_expected.to run.with_params(['κ℮ұ1', '√āĺűẻ1']).and_return({ 'κ℮ұ1' => '√āĺűẻ1' }) }
14   it { is_expected.to run.with_params(['key1', 'value1', 'key2', 'value2']).and_return({ 'key1' => 'value1', 'key2' => 'value2' }) }
15 end