Sha256: f0afad7258f9f336778b97cdb9b72bfde0e19e01107b8ba34265fbd419a82746

Contents?: true

Size: 981 Bytes

Versions: 6

Compression:

Stored size: 981 Bytes

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::Query::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
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
dbee-1.0.1 spec/dbee/query/key_path_spec.rb
dbee-1.0.0 spec/dbee/query/key_path_spec.rb
dbee-1.0.0.pre.alpha.3 spec/dbee/query/key_path_spec.rb
dbee-1.0.0.pre.alpha.2 spec/dbee/query/key_path_spec.rb
dbee-1.0.0.pre.alpha.1 spec/dbee/query/key_path_spec.rb
dbee-1.0.0.pre.alpha spec/dbee/query/key_path_spec.rb