Sha256: 740980005582711302ae7f9f42f090669a2f7d776b9627cbd3e6edbcdfc355d5

Contents?: true

Size: 1.65 KB

Versions: 3

Compression:

Stored size: 1.65 KB

Contents

require 'spec_helper'
require 'contentful/management/space'
require 'contentful/management/client'

module Contentful
  module Management
    describe WebhookHealth do
      let(:token) { ENV.fetch('CF_TEST_CMA_TOKEN', '<ACCESS_TOKEN>') }
      let(:space_id) { 'orzkxlxlq59d' }
      let(:webhook_id) { '16ypL3XjNK6oreLPPoVBxI' }
      let!(:client) { Client.new(token) }

      subject { client.webhook_health }

      describe '.all' do
        it 'is not supported' do
          expect { subject.all }.to raise_error 'Not supported'
        end
      end

      describe '.find' do
        it 'class method also works' do
          vcr('webhook_health/find') {
            expect(Contentful::Management::WebhookHealth.find(
              client,
              space_id,
              webhook_id
            )).to be_kind_of Contentful::Management::WebhookHealth
          }
        end
        it 'returns a Contentful::Management::WebhookHealth' do
          vcr('webhook_health/find') { expect(subject.find(space_id, webhook_id)).to be_kind_of Contentful::Management::WebhookHealth }
        end
        it 'returns webhook for a given id' do
          vcr('webhook_health/find') do
            webhook_health = subject.find(space_id, webhook_id)
            expect(webhook_health.calls).to be_a ::Hash

            expect(webhook_health.calls['total']).to eq 2
            expect(webhook_health.calls['healthy']).to eq 2

            expect(webhook_health.healthy).to eq 2
            expect(webhook_health.total).to eq 2
            expect(webhook_health.errors?).to eq false
            expect(webhook_health.healthy?).to eq true
          end
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
contentful-management-1.10.1 spec/lib/contentful/management/webhook_health_spec.rb
contentful-management-1.10.0 spec/lib/contentful/management/webhook_health_spec.rb
contentful-management-1.9.0 spec/lib/contentful/management/webhook_health_spec.rb