Sha256: fb55b21dbf8ea7d5645fddf971ae5ae2db83711266e0d0b848b9d1a30c07d764

Contents?: true

Size: 818 Bytes

Versions: 6

Compression:

Stored size: 818 Bytes

Contents

# frozen_string_literal: true

require 'spec_helper'
require 'fortnox/api/types'
require 'fortnox/api/types/examples/types'

describe Fortnox::API::Types do
  let(:klass) { Fortnox::API::Types::AccountNumber }

  describe 'AccountNumber' do
    context 'when created with nil' do
      subject { klass[nil] }

      it { is_expected.to be_nil }
    end

    context 'when created with empty string' do
      subject { klass[''] }

      it { is_expected.to be_nil }
    end

    context 'when created with valid number' do
      include_examples 'equals input', 1234
    end

    context 'when created with a too large number' do
      include_examples 'raises ConstraintError', 10_000
    end

    context 'when created with a negative number' do
      include_examples 'raises ConstraintError', -1
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
fortnox-api-0.9.1 spec/fortnox/api/types/account_number_spec.rb
fortnox-api-0.8.2 spec/fortnox/api/types/account_number_spec.rb
fortnox-api-0.8.1 spec/fortnox/api/types/account_number_spec.rb
fortnox-api-0.9.0 spec/fortnox/api/types/account_number_spec.rb
fortnox-api-0.8.0 spec/fortnox/api/types/account_number_spec.rb
fortnox-api-0.7.2 spec/fortnox/api/types/account_number_spec.rb