Sha256: 688e4fb36e1653109a3c89f377e62e274a9eaeca2b2d3aaebecb16ea08064da4

Contents?: true

Size: 718 Bytes

Versions: 3

Compression:

Stored size: 718 Bytes

Contents

# frozen_string_literal: true

require 'spec_helper'

describe Darthjee::CoreExt::Array::HashBuilder do
  describe 'yard' do
    describe '#build' do
      subject { described_class.new(values, keys) }

      let(:values) { [10, 20, 30] }
      let(:keys)   { %i[a b c] }

      it 'builds a hash pairing the keys and values' do
        expect(subject.build).to eq(
          a: 10, b: 20, c: 30
        )
      end

      context 'when trying to rebuild a hash' do
        let(:hash)   { { a: 20, b: 200, c: 2000 } }
        let(:values) { hash.values }
        let(:keys)   { hash.keys }

        it 'rebuilds the original hash' do
          expect(subject.build).to eq(hash)
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
darthjee-core_ext-1.7.3 spec/integration/yard/array/hash_builder_spec.rb
darthjee-core_ext-1.7.2 spec/integration/yard/array/hash_builder_spec.rb
darthjee-core_ext-1.7.1 spec/integration/yard/array/hash_builder_spec.rb