- it "should convert YAML to a data structure" do
- yaml = <<-EOS
-- aaa
-- bbb
-- ccc
-EOS
- result = scope.function_parseyaml([yaml])
- expect(result).to(eq(['aaa','bbb','ccc']))
+ context 'with incorrect YAML data' do
+ it 'supports a structure for a default value' do
+ is_expected.to run.with_params('', 'a' => '1')
+ .and_return('a' => '1')
+ end
+
+ [1, 1.2, nil, true, false, [], {}, :yaml].each do |value|
+ it "should return the default value for an incorrect #{value.inspect} (#{value.class}) parameter" do
+ is_expected.to run.with_params(value, 'default_value')
+ .and_return('default_value')
+ end
+ end
+
+ context 'when running on modern rubies' do
+ ['---', '...', '*8', ''].each do |value|
+ it "should return the default value for an incorrect #{value.inspect} string parameter" do
+ is_expected.to run.with_params(value, 'default_value')
+ .and_return('default_value')
+ end
+ end
+ end