@@ -426,29 +426,37 @@ defmodule Scenic.CacheTest do
426
426
427
427
test "request & stop notification put" do
428
428
assert Registry . keys ( @ cache_registry , self ( ) ) == [ ]
429
- Cache . request_notification ( @ cache_put )
429
+ Cache . subscribe ( @ cache_put )
430
430
assert Registry . keys ( @ cache_registry , self ( ) ) == [ @ cache_put ]
431
- Cache . stop_notification ( @ cache_put )
431
+ Cache . unsubscribe ( @ cache_put )
432
432
assert Registry . keys ( @ cache_registry , self ( ) ) == [ ]
433
433
end
434
434
435
435
test "request & stop notification delete" do
436
436
assert Registry . keys ( @ cache_registry , self ( ) ) == [ ]
437
- Cache . request_notification ( @ cache_delete )
437
+ Cache . subscribe ( @ cache_delete )
438
438
assert Registry . keys ( @ cache_registry , self ( ) ) == [ @ cache_delete ]
439
- Cache . stop_notification ( @ cache_delete )
439
+ Cache . unsubscribe ( @ cache_delete )
440
440
assert Registry . keys ( @ cache_registry , self ( ) ) == [ ]
441
441
end
442
442
443
443
test "request & stop notification claim" do
444
444
assert Registry . keys ( @ cache_registry , self ( ) ) == [ ]
445
- Cache . request_notification ( @ cache_claim )
445
+ Cache . subscribe ( @ cache_claim )
446
446
assert Registry . keys ( @ cache_registry , self ( ) ) == [ @ cache_claim ]
447
- Cache . stop_notification ( @ cache_claim )
447
+ Cache . unsubscribe ( @ cache_claim )
448
448
assert Registry . keys ( @ cache_registry , self ( ) ) == [ ]
449
449
end
450
450
451
451
test "request & stop notification release" do
452
+ assert Registry . keys ( @ cache_registry , self ( ) ) == [ ]
453
+ Cache . subscribe ( @ cache_release )
454
+ assert Registry . keys ( @ cache_registry , self ( ) ) == [ @ cache_release ]
455
+ Cache . unsubscribe ( @ cache_release )
456
+ assert Registry . keys ( @ cache_registry , self ( ) ) == [ ]
457
+ end
458
+
459
+ test "deprecated start/stop still work`" do
452
460
assert Registry . keys ( @ cache_registry , self ( ) ) == [ ]
453
461
Cache . request_notification ( @ cache_release )
454
462
assert Registry . keys ( @ cache_registry , self ( ) ) == [ @ cache_release ]
@@ -480,15 +488,15 @@ defmodule Scenic.CacheTest do
480
488
refute Cache . member? ( "test_key" )
481
489
482
490
# sign up for notifications
483
- Cache . request_notification ( @ cache_put )
491
+ Cache . subscribe ( @ cache_put )
484
492
refute_received ( { :"$gen_cast" , { :cache_put , _ } } )
485
493
486
494
# put the key. This should send a notification
487
495
Cache . put ( "test_key" , 123 )
488
496
assert_received ( { :"$gen_cast" , { :cache_put , "test_key" } } )
489
497
490
- # stop notifications
491
- Cache . stop_notification ( )
498
+ # stop notificationsunsubscribe
499
+ Cache . unsubscribe ( )
492
500
Cache . put ( "test_key1" , 123 )
493
501
refute_received ( { :"$gen_cast" , { :cache_put , _ } } )
494
502
end
0 commit comments