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
2121 include Hooks ::App ::Auth
2222
2323 class << self
24- attr_reader :start_time
24+ attr_reader :server_start_time
2525 end
2626
2727 # Create a new configured API class
2828 def self . create ( config :, endpoints :, log :)
29- @start_time = Time . now
29+ @server_start_time = Time . now
3030
3131 Hooks ::Log . instance = log
3232
Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ class HealthEndpoint < Grape::API
1212 status : "healthy" ,
1313 timestamp : Time . now . iso8601 ,
1414 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
1616 } . to_json
1717 end
1818 end
Original file line number Diff line number Diff line change @@ -10,8 +10,8 @@ def app
1010 end
1111
1212 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" ) )
1515 end
1616
1717 describe "GET /" do
@@ -66,7 +66,7 @@ def app
6666 it "calculates uptime correctly" do
6767 # Test with different start time
6868 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 )
7070
7171 get "/"
7272
You can’t perform that action at this time.
0 commit comments