diff --git a/.rspec b/.rspec index fb8d3594..333d91ee 100644 --- a/.rspec +++ b/.rspec @@ -1,3 +1,3 @@ --format documentation --color ---order rand \ No newline at end of file +--order rand diff --git a/spec/puppet/resource_api/base_type_definition_spec.rb b/spec/puppet/resource_api/base_type_definition_spec.rb index 50a5e9c9..7dde99a9 100644 --- a/spec/puppet/resource_api/base_type_definition_spec.rb +++ b/spec/puppet/resource_api/base_type_definition_spec.rb @@ -131,6 +131,10 @@ Puppet.settings[:strict] = strict_level end + after(:each) do + Puppet::ResourceApi.warning_count = 0 + end + context 'when puppet strict is set to default (warning)' do it 'displays up to 100 warnings' do expect(Puppet).to receive(:warning).with(message).exactly(100).times @@ -168,6 +172,10 @@ Puppet.settings[:strict] = strict_level end + after(:each) do + Puppet::ResourceApi.warning_count = 0 + end + context 'when puppet strict is set to default (warning)' do it 'displays up to 100 warnings' do expect(Puppet).to receive(:warning).with(message).exactly(100).times diff --git a/spec/puppet/resource_api_spec.rb b/spec/puppet/resource_api_spec.rb index d39c2cad..9911f119 100644 --- a/spec/puppet/resource_api_spec.rb +++ b/spec/puppet/resource_api_spec.rb @@ -1802,22 +1802,22 @@ def set(_context, changes) end it { expect { described_class.register_type(definition) }.not_to raise_error } - it 'is seen as a supported feature' do - expect(Puppet).not_to receive(:warning).with(%r{Unknown feature detected:.*simple_test_filter}) - expect { described_class.register_type(definition) }.not_to raise_error - end + context 'with the type registered' do + it 'is seen as a supported feature' do + expect(Puppet).not_to receive(:warning).with(%r{Unknown feature detected:.*simple_test_filter}) + expect { described_class.register_type(definition) }.not_to raise_error + end - it 'passes through the an empty array to `get`' do - expect { described_class.register_type(definition) }.not_to raise_error - expect(provider).to receive(:get).with(anything, []).and_return([]) - type.instances - end + it 'passes through the an empty array to `get`' do + expect(provider).to receive(:get).with(anything, []).and_return([]) + type.instances + end - it 'passes through the resource title to `get`' do - expect { described_class.register_type(definition) }.not_to raise_error - instance = type.new(name: 'bar', ensure: 'present') - expect(provider).to receive(:get).with(anything, ['bar']).and_return([]) - instance.retrieve + it 'passes through the resource title to `get`' do + instance = type.new(name: 'bar', ensure: 'present') + expect(provider).to receive(:get).with(anything, ['bar']).and_return([]) + instance.retrieve + end end end