Sha256: fb3a7d25eaee40646059fb9c8c23c9722d1646fd504974797861ab099122d75b

Contents?: true

Size: 914 Bytes

Versions: 4

Compression:

Stored size: 914 Bytes

Contents

# Copyright 2018 Daniel Herzog
# Use of this source code is governed by an MIT
# license that can be found in the LICENSE.md file.
# frozen_string_literal: true

require 'spec_helper'

describe DeepL::Resources::Usage do
  subject(:usage) { described_class.new(3, 5, nil, nil) }

  describe '#initialize' do
    context 'when building a basic object' do
      it 'creates a resource' do
        expect(usage).to be_a(described_class)
      end

      it 'assigns the attributes' do
        expect(usage.character_count).to eq(3)
        expect(usage.character_limit).to eq(5)
      end

      it 'does not exceed the quota' do
        expect(usage).not_to be_quota_exceeded
      end
    end

    context 'when building a quota exceeded object' do
      subject(:usage) { described_class.new(5, 5, nil, nil) }

      it 'exceeds the quota' do
        expect(usage).to be_quota_exceeded
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
deepl-rb-3.1.0 spec/resources/usage_spec.rb
deepl-rb-3.0.2 spec/resources/usage_spec.rb
deepl-rb-3.0.1 spec/resources/usage_spec.rb
deepl-rb-3.0.0 spec/resources/usage_spec.rb