Sha256: ae619d54f0365d5f47aff7ab0b4539ab8c12b2a5bc3b3e6b4f867cd788592a81
Contents?: true
Size: 1.22 KB
Versions: 2
Compression:
Stored size: 1.22 KB
Contents
# frozen_string_literal: true require 'spec_helper' require 'webmock' RSpec.describe Gman::Client do include WebMock::API let(:client) do Gman::Client.new( url: stubbed_url, client_id: 'client_id', client_secret: 'client_secret' ) end describe '#health_check' do let(:described) { client.health_check } let(:access_token) { SecureRandom.uuid } let(:stubbed_url) { 'http://test.local' } before do stub_request(:post, "#{stubbed_url}/oauth/token") .to_return( body: { access_token: access_token }.to_json, status: 200 ) stub_request( :get, "#{stubbed_url}/api/v1/health_check.json" ) .to_return(body: health_check_hash.to_json, status: 200) end let(:access_token) { SecureRandom.uuid } subject do described end context 'when the health check is successful' do let(:health_check_hash) { { health_check: 'Passed' } } it 'should be true' do expect(subject).to eq(true) end end context 'when the health check fails' do let(:health_check_hash) { { health_check: 'Failed' } } it 'should be false' do expect(subject).to eq(false) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
gman_client-0.4.1 | spec/lib/client/health_check_spec.rb |
gman_client-0.4.0 | spec/lib/client/health_check_spec.rb |