Sha256: 5bf9a3042c8b0e5a327bf09f7457ee83f2f6b85aa167f0655561175a54729a97
Contents?: true
Size: 1.4 KB
Versions: 2
Compression:
Stored size: 1.4 KB
Contents
# frozen_string_literal: true require 'rails_helper' RSpec.describe 'Healthcheck middleware', type: :request do it "renders middleware's response" do get '/healthcheck' expect(response.body).to include("It's alive!") expect(response.status).to eq 200 allow(ActiveRecord::Base).to receive(:connected?) { false } get '/healthcheck?full=1' expect(response.body).to include("Can't connect to database.") expect(response.status).to eq 422 get '/healthcheck?checks=active_record' expect(response.body).to include("Can't connect to database.") expect(response.status).to eq 422 get '/healthcheck' expect(response.body).to include("It's alive!") expect(response.status).to eq 200 allow(ActiveRecord::Base).to receive(:connected?).and_call_original get '/healthcheck?full=1' expect(response.body).to include("It's alive!") expect(response.status).to eq 200 get '/healthcheck?checks=active_record' expect(response.body).to include("It's alive!") expect(response.status).to eq 200 end it 'renders error if checker is undefined' do get '/healthcheck?checks=active_record,something_funny,redis' expect(response.body).to include("Can't find checker: SomethingFunny") expect(response.body).to include("Can't find checker: Redis") end it 'renders standard response' do get '/' expect(response.body).to include('Home') end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
middleware_healthcheck-1.0.1 | spec/requests/healthcheck_spec.rb |
middleware_healthcheck-1.0.0 | spec/requests/healthcheck_spec.rb |