@@ -312,9 +312,6 @@ def valid?; false; end;
312
312
end
313
313
314
314
should "not update an invalid model" do
315
- subject . expects ( :persisted? ) . returns ( true )
316
- subject . expects ( :id ) . returns ( 'abc123' ) . at_least_once
317
-
318
315
@gateway
319
316
. expects ( :update )
320
317
. never
@@ -323,19 +320,19 @@ def valid?; false; end;
323
320
def valid? ; false ; end ;
324
321
end
325
322
326
- assert ! subject . update
327
- assert ! subject . persisted?
323
+ assert ! subject . update ( title : 'INVALID' )
328
324
end
329
325
330
326
should "skip the validation with the :validate option" do
331
- subject . expects ( :persisted? ) . returns ( true )
327
+ subject . expects ( :persisted? ) . returns ( true ) . at_least_once
332
328
subject . expects ( :id ) . returns ( 'abc123' ) . at_least_once
333
329
334
330
@gateway
335
331
. expects ( :update )
336
332
. with do |object , options |
337
- assert_equal subject , object
333
+ assert_equal 'abc123' , object
338
334
assert_equal nil , options [ :id ]
335
+ assert_equal 'INVALID' , options [ :doc ] [ :title ]
339
336
true
340
337
end
341
338
. returns ( { '_id' => 'abc123' } )
@@ -344,7 +341,7 @@ def valid?; false; end;
344
341
def valid? ; false ; end ;
345
342
end
346
343
347
- assert subject . update validate : false
344
+ assert subject . update ( { title : 'INVALID' } , { validate : false } )
348
345
assert subject . persisted?
349
346
end
350
347
0 commit comments