Sha256: a4a59c84a789a3e367a64a6f8b4fc7d2e88cb0234526df8b829f36d47b49b92c

Contents?: true

Size: 802 Bytes

Versions: 5

Compression:

Stored size: 802 Bytes

Contents

require 'spec_helper'

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

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

      it 'should assign the attributes' do
        expect(subject.character_count).to eq(3)
        expect(subject.character_limit).to eq(5)
      end

      it 'should not exceed the quota' do
        expect(subject.quota_exceeded?).to be_falsey
      end
    end

    context 'When building a quota exceeded object' do
      subject { DeepL::Resources::Usage.new(5, 5, nil, nil) }

      it 'should exceed the quota' do
        expect(subject.quota_exceeded?).to be_truthy
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

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