Sha256: b1a3ffecfa1a52eaf2693c39758afe1e2842f0bc86321076f9078f17a93c78cf

Contents?: true

Size: 790 Bytes

Versions: 5

Compression:

Stored size: 790 Bytes

Contents

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

5 entries across 5 versions & 1 rubygems

Version Path
deepl-rb-2.2.2 spec/requests/usage_spec.rb
deepl-rb-2.2.1 spec/requests/usage_spec.rb
deepl-rb-2.2.0 spec/requests/usage_spec.rb
deepl-rb-2.1.0 spec/requests/usage_spec.rb
deepl-rb-2.0.0 spec/requests/usage_spec.rb