File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -136,9 +136,11 @@ def test_client_retry_after_seconds
136136 end
137137
138138 def test_client_retry_after_date
139+ time_now = Time . now
140+
139141 stub_request ( :post , "http://localhost/api/v1/files/upload" ) . to_return_json (
140142 status : 500 ,
141- headers : { "retry-after" => ( Time . now + 10 ) . httpdate } ,
143+ headers : { "retry-after" => ( time_now + 10 ) . httpdate } ,
142144 body : { }
143145 )
144146
@@ -150,11 +152,11 @@ def test_client_retry_after_date
150152 max_retries : 1
151153 )
152154
155+ Thread . current . thread_variable_set ( :time_now , time_now )
153156 assert_raises ( Imagekitio ::Errors ::InternalServerError ) do
154- Thread . current . thread_variable_set ( :time_now , Time . now )
155157 image_kit . files . upload ( file : Pathname ( __FILE__ ) , file_name : "fileName" )
156- Thread . current . thread_variable_set ( :time_now , nil )
157158 end
159+ Thread . current . thread_variable_set ( :time_now , nil )
158160
159161 assert_requested ( :any , /./ , times : 2 )
160162 assert_in_delta ( 10 , Thread . current . thread_variable_get ( :mock_sleep ) . last , 1.0 )
You can’t perform that action at this time.
0 commit comments