File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed
Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -100,19 +100,21 @@ def test_client_retry_after_seconds
100100 end
101101
102102 def test_client_retry_after_date
103+ time_now = Time . now
104+
103105 stub_request ( :get , "http://localhost/brand/retrieve" ) . to_return_json (
104106 status : 500 ,
105- headers : { "retry-after" => ( Time . now + 10 ) . httpdate } ,
107+ headers : { "retry-after" => ( time_now + 10 ) . httpdate } ,
106108 body : { }
107109 )
108110
109111 brand_dev = BrandDev ::Client . new ( base_url : "http://localhost" , api_key : "My API Key" , max_retries : 1 )
110112
113+ Thread . current . thread_variable_set ( :time_now , time_now )
111114 assert_raises ( BrandDev ::Errors ::InternalServerError ) do
112- Thread . current . thread_variable_set ( :time_now , Time . now )
113115 brand_dev . brand . retrieve ( domain : "domain" )
114- Thread . current . thread_variable_set ( :time_now , nil )
115116 end
117+ Thread . current . thread_variable_set ( :time_now , nil )
116118
117119 assert_requested ( :any , /./ , times : 2 )
118120 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