Sha256: d5c7c6a640833d0658e24e815f535a5788112246d178b0d992125b988208e225

Contents?: true

Size: 826 Bytes

Versions: 33

Compression:

Stored size: 826 Bytes

Contents

# frozen_string_literal: true

require 'rails_helper'

RSpec.describe Primary::Connect::Name do
  describe 'Nameable' do
    describe '#full_name' do
      it 'concatenates first, middle and last name' do
        name = described_class.new(first_name: 'Jon', middle_name: 'bon', last_name: 'Jovi')
        expect(name.full_name).to eq('Jon bon Jovi')
      end

      it 'removes leading/trailing space' do
        name = described_class.new(first_name: ' Jon ', middle_name: ' bon', last_name: 'Jovi ')
        expect(name.full_name).to eq('Jon bon Jovi')
      end

      context 'when a part is missing' do
        it 'is omitted in the concatenation' do
          name = described_class.new(first_name: 'Bob', last_name: 'Smith')
          expect(name.full_name).to eq('Bob Smith')
        end
      end
    end
  end
end

Version data entries

33 entries across 33 versions & 1 rubygems

Version Path
primary_connect_proto-0.20.0 spec/protobuf/name_spec.rb
primary_connect_proto-0.19.0 spec/protobuf/name_spec.rb
primary_connect_proto-0.18.0 spec/protobuf/name_spec.rb
primary_connect_proto-0.17.0 spec/protobuf/name_spec.rb
primary_connect_proto-0.16.0 spec/protobuf/name_spec.rb
primary_connect_proto-0.15.0 spec/protobuf/name_spec.rb
primary_connect_proto-0.14.0 spec/protobuf/name_spec.rb
primary_connect_proto-0.13.0 spec/protobuf/name_spec.rb
primary_connect_proto-0.12.1 spec/protobuf/name_spec.rb
primary_connect_proto-0.12.0 spec/protobuf/name_spec.rb
primary_connect_proto-0.11.0 spec/protobuf/name_spec.rb
primary_connect_proto-0.10.2 spec/protobuf/name_spec.rb
primary_connect_proto-0.10.1 spec/protobuf/name_spec.rb
primary_connect_proto-0.9.0 spec/protobuf/name_spec.rb
primary_connect_proto-0.8.2 spec/protobuf/name_spec.rb
primary_connect_proto-0.8.1 spec/protobuf/name_spec.rb
primary_connect_proto-0.8.0 spec/protobuf/name_spec.rb
primary_connect_proto-0.7.3 spec/protobuf/name_spec.rb
primary_connect_proto-0.7.2 spec/protobuf/name_spec.rb
primary_connect_proto-0.7.1 spec/protobuf/name_spec.rb