Sha256: 4de86bb98a436df350095215bc2e7a76e374373b42419e65c24e6de6baef036f

Contents?: true

Size: 821 Bytes

Versions: 9

Compression:

Stored size: 821 Bytes

Contents

# frozen_string_literal: true

require 'spec_helper'

describe DeepL::Requests::Usage do
  let(:api) { build_deepl_api }
  let(:options) { {} }
  subject { DeepL::Requests::Usage.new(api, options) }

  describe '#initialize' do
    context 'When building a request' do
      it 'should create a request object' do
        expect(subject).to be_a(DeepL::Requests::Usage)
      end
    end
  end

  describe '#request' do
    around do |example|
      VCR.use_cassette('usage') { example.call }
    end

    context 'When performing a valid request' do
      it 'should return an usage object' do
        usage = subject.request

        expect(usage).to be_a(DeepL::Resources::Usage)
        expect(usage.character_count).to be_a(Numeric)
        expect(usage.character_limit).to be_a(Numeric)
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
deepl-rb-2.5.3 spec/requests/usage_spec.rb
deepl-rb-2.5.2 spec/requests/usage_spec.rb
deepl-rb-2.5.1 spec/requests/usage_spec.rb
deepl-rb-2.5.0 spec/requests/usage_spec.rb
deepl-rb-2.4.0 spec/requests/usage_spec.rb
deepl-rb-2.3.1 spec/requests/usage_spec.rb
deepl-rb-2.3.0 spec/requests/usage_spec.rb
deepl-rb-2.2.4 spec/requests/usage_spec.rb
deepl-rb-2.2.3 spec/requests/usage_spec.rb