Sha256: c8d8aa979ba63837ef188c0702e443be63f7f330cfa0a3ddf650134d7f1f7f7a
Contents?: true
Size: 1.3 KB
Versions: 1
Compression:
Stored size: 1.3 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' require 'examples/person' describe ::Hashematics::ObjectInterface do let(:input) do { id: 1, 'first' => 'Matt' } end let(:person) { Person.new(input) } it 'should read hash indifferently' do expect(described_class.get(input, :id)).to eq(input[:id]) expect(described_class.get(input, 'id')).to eq(input[:id]) expect(described_class.get(input, :first)).to eq(input['first']) expect(described_class.get(input, 'first')).to eq(input['first']) expect(described_class.get(person, 'doesnt_exist')).to eq(nil) expect(described_class.get(person, :doesnt_exist)).to eq(nil) end it 'should read object if object is responsive' do expect(described_class.get(person, :id)).to eq(input[:id]) expect(described_class.get(person, 'id')).to eq(input[:id]) expect(described_class.get(person, :first)).to eq(input['first']) expect(described_class.get(person, 'first')).to eq(input['first']) expect(described_class.get(person, 'doesnt_exist')).to eq(nil) expect(described_class.get(person, :doesnt_exist)).to eq(nil) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
hashematics-1.0.0 | spec/hashematics/object_interface_spec.rb |