Skip to content

Commit

Permalink
(maint) avoid clashing test with actual fixture
Browse files Browse the repository at this point in the history
When enabling rspec-puppet support for all example groups,
this test fails because of the naming clash with the real
`test_simple_get_filter` type and provider in the fixtures
module.

Changing the name avoids this.
  • Loading branch information
DavidS committed Jun 27, 2019
1 parent 9922bc6 commit 574ef57
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions spec/puppet/resource_api_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1782,7 +1782,7 @@ def set(_context, _changes, noop: false); end
context 'with a `simple_get_filter` provider', agent_test: true do
let(:definition) do
{
name: 'test_simple_get_filter',
name: 'test_simple_get_filter_2',
features: ['simple_get_filter'],
attributes: {
ensure: {
Expand All @@ -1796,21 +1796,21 @@ def set(_context, _changes, noop: false); end
},
}
end
let(:type) { Puppet::Type.type(:test_simple_get_filter) }
let(:type) { Puppet::Type.type(:test_simple_get_filter_2) }
let(:provider_class) do
Class.new do
Class.new() do
def get(_context, _names = nil)
[]
end

def set(_context, changes) end
end
end
let(:provider) { instance_double('Puppet::Provider::TestSimpleGetFilter::TestSimpleGetFilter', 'provider') }
let(:provider) { instance_double('Puppet::Provider::TestSimpleGetFilter2::TestSimpleGetFilter2', 'provider') }

before(:each) do
stub_const('Puppet::Provider::TestSimpleGetFilter', Module.new)
stub_const('Puppet::Provider::TestSimpleGetFilter::TestSimpleGetFilter', provider_class)
stub_const('Puppet::Provider::TestSimpleGetFilter2', Module.new)
stub_const('Puppet::Provider::TestSimpleGetFilter2::TestSimpleGetFilter2', provider_class)
allow(provider_class).to receive(:new).and_return(provider)
end

Expand All @@ -1823,7 +1823,7 @@ def set(_context, changes) 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(Puppet).not_to receive(:warning).with(%r{Unknown feature detected:.*simple_test_filter_2})
expect { described_class.register_type(definition) }.not_to raise_error
end

Expand Down

0 comments on commit 574ef57

Please sign in to comment.