summaryrefslogtreecommitdiff
path: root/spec/aliases/string_spec.rb
diff options
context:
space:
mode:
authortphoney <tp@puppet.com>2016-08-08 17:35:13 +0100
committertphoney <tp@puppet.com>2016-08-08 17:46:11 +0100
commit22fbe723acd22ae3491c41beeacbc76853c6820e (patch)
treec91448e5face966d92d713b537316adcd08fbac3 /spec/aliases/string_spec.rb
parente39fe01ea01719b97110341cacc4b4e2784a7d1a (diff)
(modules-3532) deprecate string type checks
Diffstat (limited to 'spec/aliases/string_spec.rb')
-rw-r--r--spec/aliases/string_spec.rb31
1 files changed, 31 insertions, 0 deletions
diff --git a/spec/aliases/string_spec.rb b/spec/aliases/string_spec.rb
new file mode 100644
index 0000000..8e01d55
--- /dev/null
+++ b/spec/aliases/string_spec.rb
@@ -0,0 +1,31 @@
+require 'spec_helper'
+
+if Puppet.version.to_f >= 4.0
+ describe 'test::string', type: :class do
+ describe 'accepts strings' do
+ [
+ '',
+ 'one',
+ ].each do |value|
+ describe value.inspect do
+ let(:params) {{ value: value }}
+ it { is_expected.to compile }
+ end
+ end
+ end
+
+ describe 'rejects other values' do
+ [
+ [],
+ {},
+ 1,
+ true,
+ ].each do |value|
+ describe value.inspect do
+ let(:params) {{ value: value }}
+ it { is_expected.to compile.and_raise_error(/parameter 'value' expects a Stdlib::Compat::String = String/) }
+ end
+ end
+ end
+ end
+end