Sha256: e4cf34d67a2fff9f5f1624f9ccd94feeb8b11b26d94edbc9987bc66f4a6a8ac7

Contents?: true

Size: 1.48 KB

Versions: 15

Compression:

Stored size: 1.48 KB

Contents

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

module Contentful
  module Management
    describe OrganizationPeriodicUsage do
      let(:token) { ENV.fetch('CF_TEST_CMA_TOKEN', '<ACCESS_TOKEN>') }
      let(:organization_id) { 'org_id' }

      let!(:client) { Client.new(token) }

      subject { client.organization_periodic_usages(organization_id) }

      describe '.all' do
        it 'class method also works' do
          vcr('organization_periodic_usage/all') { expect(Contentful::Management::OrganizationPeriodicUsage.all(client, organization_id)).to be_kind_of Contentful::Management::Array }
        end
        it 'returns a Contentful::Array' do
          vcr('organization_periodic_usage/all') { expect(subject.all).to be_kind_of Contentful::Management::Array }
        end
        it 'builds a Contentful::Management::OrganizationPeriodicUsage object' do
          vcr('organization_periodic_usage/all') { expect(subject.all.first).to be_kind_of Contentful::Management::OrganizationPeriodicUsage }
        end
        it 'builds a Contentful::Management::OrganizationPeriodicUsage object' do
          vcr('organization_periodic_usage/filters') { 
            result = subject.all('metric[in]' => 'cda')
            expect(result.size).to eq 1
            expect(result.first).to be_kind_of Contentful::Management::OrganizationPeriodicUsage
            expect(result.first.metric).to eq 'cda'
          }
        end
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
contentful-management-3.10.0 spec/lib/contentful/management/organization_periodic_usage_spec.rb
contentful-management-3.9.0 spec/lib/contentful/management/organization_periodic_usage_spec.rb
contentful-management-3.8.0 spec/lib/contentful/management/organization_periodic_usage_spec.rb
contentful-management-3.7.0 spec/lib/contentful/management/organization_periodic_usage_spec.rb
contentful-management-3.6.0 spec/lib/contentful/management/organization_periodic_usage_spec.rb
contentful-management-3.5.0 spec/lib/contentful/management/organization_periodic_usage_spec.rb
contentful-management-3.4.0 spec/lib/contentful/management/organization_periodic_usage_spec.rb
contentful-management-3.3.0 spec/lib/contentful/management/organization_periodic_usage_spec.rb
contentful-management-3.2.0 spec/lib/contentful/management/organization_periodic_usage_spec.rb
contentful-management-3.1.0 spec/lib/contentful/management/organization_periodic_usage_spec.rb
contentful-management-3.0.0 spec/lib/contentful/management/organization_periodic_usage_spec.rb
contentful-management-2.13.1 spec/lib/contentful/management/organization_periodic_usage_spec.rb
contentful-management-2.13.0 spec/lib/contentful/management/organization_periodic_usage_spec.rb
contentful-management-2.12.1 spec/lib/contentful/management/organization_periodic_usage_spec.rb
contentful-management-2.12.0 spec/lib/contentful/management/organization_periodic_usage_spec.rb