mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
31 lines
921 B
Ruby
31 lines
921 B
Ruby
# frozen_string_literal: true
|
|
|
|
module Api
|
|
RSpec.describe V0::StatusesController do
|
|
render_views
|
|
|
|
describe "job queue status" do
|
|
it "returns alive when up to date" do
|
|
Spree::Config.last_job_queue_heartbeat_at = Time.now.in_time_zone
|
|
get :job_queue
|
|
expect(response).to have_http_status :ok
|
|
expect(response.body).to eq({ alive: true }.to_json)
|
|
end
|
|
|
|
it "returns dead otherwise" do
|
|
Spree::Config.last_job_queue_heartbeat_at = 10.minutes.ago
|
|
get :job_queue
|
|
expect(response).to have_http_status :ok
|
|
expect(response.body).to eq({ alive: false }.to_json)
|
|
end
|
|
|
|
it "returns dead when no heartbeat recorded" do
|
|
Spree::Config.last_job_queue_heartbeat_at = nil
|
|
get :job_queue
|
|
expect(response).to have_http_status :ok
|
|
expect(response.body).to eq({ alive: false }.to_json)
|
|
end
|
|
end
|
|
end
|
|
end
|