Sha256: f2d0977ea2f3cc4d62e1c897d9d0828f1990713714503a92151bfb70d14bd682

Contents?: true

Size: 728 Bytes

Versions: 2

Compression:

Stored size: 728 Bytes

Contents

# frozen_string_literal: true

require 'spec_helper'

describe Darthjee::CoreExt::Array::HashBuilder do
  describe 'yard' do
    describe '#build' do
      subject(:builder) { 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(builder.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(builder.build).to eq(hash)
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
darthjee-core_ext-2.0.0 spec/integration/yard/darthjee/core_ext/array/hash_builder_spec.rb
darthjee-core_ext-1.7.4 spec/integration/yard/darthjee/core_ext/array/hash_builder_spec.rb