@@ -156,7 +156,7 @@ def new_model
156156 end
157157 end
158158
159- describe '#save_with_new_operation ' do
159+ describe '#save_with_attributes_and_new_operation ' do
160160 let ( :service_instance ) { ServiceInstance . make }
161161 let ( :binding ) {
162162 ServiceKey . new (
@@ -172,7 +172,7 @@ def new_model
172172 type : 'create' ,
173173 description : '10%'
174174 }
175- binding . save_with_new_operation ( last_operation )
175+ binding . save_with_attributes_and_new_operation ( { } , last_operation )
176176
177177 expect ( binding . last_operation . state ) . to eq 'in progress'
178178 expect ( binding . last_operation . description ) . to eq '10%'
@@ -186,15 +186,15 @@ def new_model
186186 end
187187
188188 it 'should rollback the binding' do
189- expect { binding . save_with_new_operation ( { state : 'will fail' } ) } . to raise_error ( Sequel ::DatabaseError )
189+ expect { binding . save_with_attributes_and_new_operation ( { } , { state : 'will fail' } ) } . to raise_error ( Sequel ::DatabaseError )
190190 expect ( ServiceKey . where ( guid : binding . guid ) . count ) . to eq ( 0 )
191191 end
192192 end
193193
194194 context 'when called twice' do
195- it 'does saves the second operation' do
196- binding . save_with_new_operation ( { state : 'in progress' , type : 'create' , description : 'description' } )
197- binding . save_with_new_operation ( { state : 'in progress' , type : 'delete' } )
195+ it 'does save the second operation' do
196+ binding . save_with_attributes_and_new_operation ( { } , { state : 'in progress' , type : 'create' , description : 'description' } )
197+ binding . save_with_attributes_and_new_operation ( { } , { state : 'in progress' , type : 'delete' } )
198198
199199 expect ( binding . last_operation . state ) . to eq 'in progress'
200200 expect ( binding . last_operation . type ) . to eq 'delete'
@@ -220,7 +220,7 @@ def new_model
220220 }
221221
222222 it 'updates the attributes' do
223- binding . save_with_new_operation ( last_operation , attributes : attributes )
223+ binding . save_with_attributes_and_new_operation ( attributes , last_operation )
224224 binding . reload
225225 expect ( binding . last_operation . state ) . to eq 'in progress'
226226 expect ( binding . last_operation . description ) . to eq '10%'
@@ -232,13 +232,15 @@ def new_model
232232
233233 it 'only saves permitted attributes' do
234234 expect {
235- binding . save_with_new_operation ( last_operation , attributes : attributes . merge (
236- parameters : {
237- foo : 'bar' ,
238- ding : 'dong'
239- } ,
240- endpoints : [ { host : 'mysqlhost' , ports : [ '3306' ] } ] ,
241- ) )
235+ binding . save_with_attributes_and_new_operation ( attributes . merge (
236+ parameters : {
237+ foo : 'bar' ,
238+ ding : 'dong'
239+ } ,
240+ endpoints : [ { host : 'mysqlhost' , ports : [ '3306' ] } ] ,
241+ ) ,
242+ last_operation
243+ )
242244 } . not_to raise_error
243245 end
244246 end
0 commit comments