Files
chatwoot/spec/controllers/super_admin/instance_statuses_controller_spec.rb
Vishnu Narayanan b1af814eab feat: add chatwoot instance status in superadmin (#6045)
* feat: add chatwoot instance status in superadmin

* feat: add redis metrics to instance health page

* chore: fix rubocop

* chore: rescue redis no connection

* chore: add rspec

* chore: refactor

* feat: add instance health to /api

* chore: rescue postgres

* chore: fix spec
2023-01-30 18:37:51 +05:30

26 lines
815 B
Ruby

require 'rails_helper'
RSpec.describe 'Super Admin Instance health', type: :request do
let(:super_admin) { create(:super_admin) }
describe 'GET /super_admin/instance_status' do
context 'when it is an unauthenticated super admin' do
it 'returns unauthorized' do
get '/super_admin/instance_status'
expect(response).to have_http_status(:redirect)
end
end
context 'when it is an authenticated super admin' do
it 'shows the instance_status page' do
sign_in(super_admin, scope: :super_admin)
get '/super_admin/instance_status'
expect(response).to have_http_status(:success)
expect(response.body).to include('Chatwoot version')
sha = `git rev-parse HEAD`
expect(response.body).to include(sha)
end
end
end
end