Sha256: 4176e67523f7b26ac7cec76abfec39fe1872956093d4a6606055cdd34446df98

Contents?: true

Size: 496 Bytes

Versions: 141

Compression:

Stored size: 496 Bytes

Contents

# frozen_string_literal: true

require 'eac_ruby_utils/patches/object/compact'

::RSpec.describe ::Object do
  let(:instance) { ::OpenStruct.new(a_attr: 'a_value', b_attr: 'b_value') }
  let(:attributes) { %w[a_attr b_attr] }

  describe '#compact' do
    it do
      expect(instance.compact_to_a(*attributes)).to eq(%w[a_value b_value])
    end
  end

  describe '#to_h' do
    it do
      expect(instance.compact_to_h(*attributes)).to eq(a_attr: 'a_value', b_attr: 'b_value')
    end
  end
end

Version data entries

141 entries across 141 versions & 3 rubygems

Version Path
ehbrs-tools-0.26.0 vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/object/compact_spec.rb