Sha256: ba0e67c1040c279634617c3943918613a6916fe6b69abccc9912b7c7b4ad117a

Contents?: true

Size: 1.53 KB

Versions: 2

Compression:

Stored size: 1.53 KB

Contents

require 'rails_helper'

module MnoEnterprise
  # Test the Status controller is still working when MnoHub is down
  # The behavior is tested in the ControllerSpec
  RSpec.describe "Status", type: :request do
    include MnoEnterprise::TestingSupport::RequestSpecHelper

    describe 'version' do
      subject { get '/mnoe/version' }
      let(:data) { JSON.parse(response.body) }

      context 'with a signed in user' do
        include_context 'signed in user'

        context 'when MnoHub is up' do
          before { subject }

          it { expect(response).to have_http_status(:ok) }
        end

        context 'when MnoHub is down' do
          before { clear_api_stubs }
          before { subject }

          it { expect(response).to have_http_status(:ok) }
        end
      end

      context 'without a signed in user' do
        before { subject }
        it { expect(response).to have_http_status(:ok) }
      end
    end

    describe 'ping' do
      subject { get '/mnoe/ping' }

      context 'with a signed in user' do
        include_context 'signed in user'

        context 'when MnoHub is up' do
          before { subject }

          it { expect(response).to have_http_status(:ok) }
        end

        context 'when MnoHub is down' do
          before { clear_api_stubs }
          before { subject }

          it { expect(response).to have_http_status(:ok) }
        end
      end

      context 'without a signed in user' do
        before { subject }
        it { expect(response).to have_http_status(:ok) }
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mno-enterprise-api-3.4.0 spec/requests/mno_enterprise/status_spec.rb
mno-enterprise-api-3.3.3 spec/requests/mno_enterprise/status_spec.rb