File tree Expand file tree Collapse file tree 3 files changed +6
-6
lines changed
spec/unit/lib/hooks/app/endpoints Expand file tree Collapse file tree 3 files changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -21,12 +21,12 @@ class API
21
21
include Hooks ::App ::Auth
22
22
23
23
class << self
24
- attr_reader :start_time
24
+ attr_reader :server_start_time
25
25
end
26
26
27
27
# Create a new configured API class
28
28
def self . create ( config :, endpoints :, log :)
29
- @start_time = Time . now
29
+ @server_start_time = Time . now
30
30
31
31
Hooks ::Log . instance = log
32
32
Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ class HealthEndpoint < Grape::API
12
12
status : "healthy" ,
13
13
timestamp : Time . now . iso8601 ,
14
14
version : Hooks ::VERSION ,
15
- uptime_seconds : ( Time . now - Hooks ::App ::API . start_time ) . to_i
15
+ uptime_seconds : ( Time . now - Hooks ::App ::API . server_start_time ) . to_i
16
16
} . to_json
17
17
end
18
18
end
Original file line number Diff line number Diff line change @@ -10,8 +10,8 @@ def app
10
10
end
11
11
12
12
before do
13
- # Mock API start_time for consistent uptime calculation
14
- allow ( Hooks ::App ::API ) . to receive ( :start_time ) . and_return ( Time . parse ( "2024-12-31T23:59:00Z" ) )
13
+ # Mock API server_start_time for consistent uptime calculation
14
+ allow ( Hooks ::App ::API ) . to receive ( :server_start_time ) . and_return ( Time . parse ( "2024-12-31T23:59:00Z" ) )
15
15
end
16
16
17
17
describe "GET /" do
@@ -66,7 +66,7 @@ def app
66
66
it "calculates uptime correctly" do
67
67
# Test with different start time
68
68
different_start = Time . parse ( "2024-12-31T23:58:30Z" )
69
- allow ( Hooks ::App ::API ) . to receive ( :start_time ) . and_return ( different_start )
69
+ allow ( Hooks ::App ::API ) . to receive ( :server_start_time ) . and_return ( different_start )
70
70
71
71
get "/"
72
72
You can’t perform that action at this time.
0 commit comments