Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .rspec
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
--format documentation
--color
--order rand
--order rand
8 changes: 8 additions & 0 deletions spec/puppet/resource_api/base_type_definition_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
28 changes: 14 additions & 14 deletions spec/puppet/resource_api_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down