@@ -1814,22 +1814,29 @@ def set(_context, changes) end
18141814 allow ( provider_class ) . to receive ( :new ) . and_return ( provider )
18151815 end
18161816
1817+ after ( :each ) do
1818+ # reset cached provider between tests
1819+ type . instance_variable_set ( :@my_provider , nil )
1820+ end
1821+
18171822 it { expect { described_class . register_type ( definition ) } . not_to raise_error }
18181823
1819- it 'is seen as a supported feature' do
1820- expect ( Puppet ) . not_to receive ( :warning ) . with ( %r{Unknown feature detected:.*simple_test_filter} )
1821- expect { described_class . register_type ( definition ) } . not_to raise_error
1822- end
1824+ context 'with the type registered' do
1825+ it 'is seen as a supported feature' do
1826+ expect ( Puppet ) . not_to receive ( :warning ) . with ( %r{Unknown feature detected:.*simple_test_filter} )
1827+ expect { described_class . register_type ( definition ) } . not_to raise_error
1828+ end
18231829
1824- it 'passes through the an empty array to `get`' do
1825- expect ( provider ) . to receive ( :get ) . with ( anything , [ ] ) . and_return ( [ ] )
1826- type . instances
1827- end
1830+ it 'passes through the an empty array to `get`' do
1831+ expect ( provider ) . to receive ( :get ) . with ( anything , [ ] ) . and_return ( [ ] )
1832+ type . instances
1833+ end
18281834
1829- it 'passes through the resource title to `get`' do
1830- instance = type . new ( name : 'bar' , ensure : 'present' )
1831- expect ( provider ) . to receive ( :get ) . with ( anything , [ 'bar' ] ) . and_return ( [ ] )
1832- instance . retrieve
1835+ it 'passes through the resource title to `get`' do
1836+ instance = type . new ( name : 'bar' , ensure : 'present' )
1837+ expect ( provider ) . to receive ( :get ) . with ( anything , [ 'bar' ] ) . and_return ( [ ] )
1838+ instance . retrieve
1839+ end
18331840 end
18341841 end
18351842
0 commit comments