@@ -72,8 +72,23 @@ func EnqueueSpec(c gospec.Context) {
7272 c .Expect (ea , IsWithin (0.1 ), nowToSecondsWithNanoPrecision ())
7373 })
7474
75- c .Specify ("has retry and retry_count when set" , func () {
76- EnqueueWithOptions ("enqueue6" , "Compare" , []string {"foo" , "bar" }, EnqueueOptions {RetryCount : 13 , Retry : true })
75+ c .Specify ("sets retry count to `retry`" , func () {
76+ EnqueueWithOptions ("enqueue6" , "Compare" , []string {"foo" , "bar" }, EnqueueOptions {RetryCount : 13 })
77+
78+ bytes , _ := redis .Bytes (conn .Do ("lpop" , "prod:queue:enqueue6" ))
79+ var result map [string ]interface {}
80+ json .Unmarshal (bytes , & result )
81+ c .Expect (result ["class" ], Equals , "Compare" )
82+
83+ retry := result ["retry" ].(float64 )
84+ c .Expect (retry , Equals , float64 (13 ))
85+
86+ retryCount := result ["retry_count" ].(float64 )
87+ c .Expect (retryCount , Equals , float64 (0 ))
88+ })
89+
90+ c .Specify ("sets Retry correctly when no count given" , func () {
91+ EnqueueWithOptions ("enqueue6" , "Compare" , []string {"foo" , "bar" }, EnqueueOptions {Retry : true })
7792
7893 bytes , _ := redis .Bytes (conn .Do ("lpop" , "prod:queue:enqueue6" ))
7994 var result map [string ]interface {}
@@ -82,9 +97,6 @@ func EnqueueSpec(c gospec.Context) {
8297
8398 retry := result ["retry" ].(bool )
8499 c .Expect (retry , Equals , true )
85-
86- retryCount := int (result ["retry_count" ].(float64 ))
87- c .Expect (retryCount , Equals , 13 )
88100 })
89101 })
90102
0 commit comments