Sha256: 2f971981b54a342c33bd2f260c24711947c032803aa2440cd0996c5ccb150589
Contents?: true
Size: 1.24 KB
Versions: 2
Compression:
Stored size: 1.24 KB
Contents
# frozen_string_literal: true # # Copyright (c) 2019-present, Blue Marble Payroll, LLC # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. # require 'spec_helper' describe Dbee::KeyPath do let(:key_path_string) { 'contacts.demographics.first' } subject { described_class.get(key_path_string) } specify '#initialize sets correct values' do expect(subject.value).to eq(key_path_string) expect(subject.column_name).to eq(key_path_string.split('.').last) expect(subject.ancestor_names).to eq(key_path_string.split('.')[0..-2]) end specify '#hash is same as value.hash' do expect(subject.hash).to eq(key_path_string.hash) end specify '#to_s is same as value' do expect(subject.to_s).to eq(key_path_string) end specify 'equality compares to value' do expect(subject).to eq(key_path_string) expect(subject).to eql(key_path_string) end describe '#ancestor_paths' do let(:key_path_string) { 'a.b.c.d.e' } subject { described_class.get(key_path_string) } it 'should include all left-inclusive paths' do expected = %w[a a.b a.b.c a.b.c.d] expect(subject.ancestor_paths).to eq(expected) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
dbee-1.0.3 | spec/dbee/key_path_spec.rb |
dbee-1.0.2 | spec/dbee/key_path_spec.rb |