summaryrefslogtreecommitdiff
path: root/spec/functions/ensure_resource_spec.rb
diff options
context:
space:
mode:
authorDominic Cleal <dominic@cleal.org>2017-04-27 10:00:04 +0100
committerHelen Campbell <helen@puppetlabs.com>2017-05-09 12:51:40 +0100
commit9244c67206363f8e887531b164fc24cef729f3d8 (patch)
treee275e9cf106f6af80ed4dd38295fe9a5879683a2 /spec/functions/ensure_resource_spec.rb
parent052d55b046706b6d68b69ac91e8d688009b3fdc1 (diff)
Test for defined_with_params() returning false for defined types
defined_with_params() now returns false for defined types, causing duplicate resources when using ensure_resources(). Introduced by 4f19c27 in PE-20308.
Diffstat (limited to 'spec/functions/ensure_resource_spec.rb')
-rwxr-xr-xspec/functions/ensure_resource_spec.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/spec/functions/ensure_resource_spec.rb b/spec/functions/ensure_resource_spec.rb
index 5366205..c847bf7 100755
--- a/spec/functions/ensure_resource_spec.rb
+++ b/spec/functions/ensure_resource_spec.rb
@@ -38,6 +38,13 @@ describe 'ensure_resource' do
it { expect(lambda { catalogue }).to contain_user('username1').with_ensure('present') }
it { expect(lambda { catalogue }).to contain_user('username1').without_gid }
end
+
+ describe 'after running ensure_resource("test::deftype", "foo", {})' do
+ before { subject.call(['test::deftype', 'foo', {}]) }
+
+ # this lambda is required due to strangeness within rspec-puppet's expectation handling
+ it { expect(lambda { catalogue }).to contain_test__deftype('foo').without_ensure }
+ end
end
context 'given a catalog with UTF8 chars' do
@@ -114,4 +121,15 @@ describe 'ensure_resource' do
}
end
end
+
+ context 'given a catalog with "test::deftype { foo: }"' do
+ let(:pre_condition) { 'test::deftype { "foo": }' }
+
+ describe 'after running ensure_resource("test::deftype", "foo", {})' do
+ before { subject.call(['test::deftype', 'foo', {}]) }
+
+ # this lambda is required due to strangeness within rspec-puppet's expectation handling
+ it { expect(lambda { catalogue }).to contain_test__deftype('foo').without_ensure }
+ end
+ end
end