Sha256: 87c0baef827d03273971271af73b28de6aad20a4a8d0a0a3e0ee17704ea369ed

Contents?: true

Size: 808 Bytes

Versions: 6

Compression:

Stored size: 808 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 }

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

    it { is_expected.to be_nil }
  end

  context 'when AccountNumber created with empty string' do
    include_examples 'raises ConstraintError', ''
  end

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

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

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

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
fortnox-api-0.7.1 spec/fortnox/api/types/account_number_spec.rb
fortnox-api-0.7.0 spec/fortnox/api/types/account_number_spec.rb
fortnox-api-0.6.3 spec/fortnox/api/types/account_number_spec.rb
fortnox-api-0.6.2 spec/fortnox/api/types/account_number_spec.rb
fortnox-api-0.6.1 spec/fortnox/api/types/account_number_spec.rb
fortnox-api-0.6.0 spec/fortnox/api/types/account_number_spec.rb