Sha256: 79cc2ad9fda96c6e8594b77d70615238d0eab2b0ae65cc4f528f45013d0dc93a

Contents?: true

Size: 820 Bytes

Versions: 6

Compression:

Stored size: 820 Bytes

Contents

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

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

  context 'Email created with nil' do
    subject{ klass[ nil ] }
    it{ is_expected.to be_nil }
  end

  context 'Email created with empty string' do
    subject{ klass[ '' ] }
    it{ is_expected.to eq('') }
  end

  context 'Email created with valid email' do
    subject{ klass[ input ] }
    let( :input ){ 'test@example.com' }
    it{ is_expected.to eq input }
  end

  context 'Email created with more than 1024 characters' do
    legal_characters = 'abcdefghijklmnopqrstuvwxyz-_+'.split('')
    too_long_email = (legal_characters * 35).shuffle.join + '@example.com'
    include_examples 'raises ConstraintError', too_long_email
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
fortnox-api-0.5.2 spec/fortnox/api/types/email_spec.rb
fortnox-api-0.5.1 spec/fortnox/api/types/email_spec.rb
fortnox-api-0.5.0 spec/fortnox/api/types/email_spec.rb
fortnox-api-0.4.0 spec/fortnox/api/types/email_spec.rb
fortnox-api-0.3.0 spec/fortnox/api/types/email_spec.rb
fortnox-api-0.2.0 spec/fortnox/api/types/email_spec.rb