@@ -214,33 +214,26 @@ def delete(context, _name); end
214214 it { expect { provider . set ( context , changes ) } . to raise_error %r{SimpleProvider cannot be used with a Type that is not ensurable} }
215215 end
216216
217- context 'with a type with multiple namevars' do
218- let ( :should_values ) { { name : 'title' , parent : 'foo' , wibble : 'wub' , ensure : 'present' } }
219- let ( :title ) { 'foo#wub' }
217+ context 'with changes from a composite namevar type' do
220218 let ( :changes ) do
221- { title =>
222- {
223- should : should_values ,
224- } }
225- end
226- let ( :name_hash ) do
227219 {
228- title : title ,
229- parent : 'foo' ,
230- wibble : 'wub' ,
220+ { name1 : 'value1' , name2 : 'value2' } =>
221+ {
222+ should : { name1 : 'value1' , name2 : 'value2' , ensure : 'present' } ,
223+ } ,
231224 }
232225 end
233226
234227 before ( :each ) do
235- allow ( context ) . to receive ( :creating ) . with ( title ) . and_yield
236- allow ( context ) . to receive ( :type ) . and_return ( type_def )
237- allow ( type_def ) . to receive ( :feature? ) . with ( 'simple_get_filter' )
228+ allow ( context ) . to receive ( :creating ) . with ( name1 : 'value1' , name2 : 'value2' ) . and_yield
229+ allow ( type_def ) . to receive ( :feature? ) . with ( 'simple_get_filter' ) . and_return ( true )
230+ allow ( type_def ) . to receive ( :namevars ) . and_return ( [ :name1 , :name2 ] )
238231 allow ( type_def ) . to receive ( :check_schema )
239- allow ( type_def ) . to receive ( :namevars ) . and_return ( [ :parent , :wibble ] )
240232 end
241233
242- it 'calls create once' do
243- expect ( provider ) . to receive ( :create ) . with ( context , name_hash , should_values ) . once
234+ it 'calls the crud methods with the right title' do
235+ expect ( provider ) . to receive ( :create ) . with ( context , { name1 : 'value1' , name2 : 'value2' } , hash_including ( name1 : 'value1' ) )
236+
244237 provider . set ( context , changes )
245238 end
246239 end
0 commit comments