mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-25 20:46:48 +00:00
33 lines
944 B
Ruby
33 lines
944 B
Ruby
# frozen_string_literal: true
|
|
|
|
require 'spec_helper'
|
|
|
|
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
|