Sha256: 2d68afdfcd4913fb3b4be58669b1a66f7a18fc04db03a278b10a564ee201dbef

Contents?: true

Size: 1.01 KB

Versions: 2

Compression:

Stored size: 1.01 KB

Contents

# frozen_string_literal: true
require 'rails_helper'

RSpec.describe TPHealthcheck::CheckController, type: :request do
  describe 'GET /healthchecks/ping' do
    context 'When get healthcheck' do
      before do
        get '/healthchecks/ping', nil, nil
      end

      it 'Does return status_code: 200' do
        expect(response).to have_http_status(:ok)
      end

      it 'Does return name project Dummy' do
        expect(response.body).to eq 'Dummy'
      end
    end
  end

  describe 'GET /healthchecks/database' do
    context 'When database is up' do
      before do
        get '/healthchecks/database', nil, nil
      end

      it 'Does return status_code: 200' do
        expect(response).to have_http_status(:ok)
      end
    end
  end

  describe 'GET /healthchecks/fake' do
    context 'When get inexistent url' do
      before do
        get '/healthchecks/fake', nil, nil
      end

      it 'Does return status_code: 404' do
        expect(response).to have_http_status(:not_found)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
tp_healthcheck-0.1.3 spec/integration_test/app/controllers/tp_healthcheck/check_controller_spec.rb
tp_healthcheck-0.1.2 spec/integration_test/app/controllers/tp_healthcheck/check_controller_spec.rb