Sha256: 75b955a6b0d23223965b5cf8a7c427930adb4567ae98f4b346dbbdc1ae284eab
Contents?: true
Size: 1.11 KB
Versions: 7
Compression:
Stored size: 1.11 KB
Contents
require 'spec_helper' RSpec.describe PolishGeeks::DevTools::Hash do describe 'same_key_structure?' do subject { h1.same_key_structure?(h2) } context 'when both are empty' do let(:h1) { PolishGeeks::DevTools::Hash.new } let(:h2) { PolishGeeks::DevTools::Hash.new } it { expect(subject).to be true } end context 'when first hash is not equal to second' do context 'on the first level' do let(:h1) { PolishGeeks::DevTools::Hash.new.merge(a: 1) } let(:h2) { PolishGeeks::DevTools::Hash.new.merge(b: 1) } it { expect(subject).to be false } end context 'on the second level' do let(:h1) { PolishGeeks::DevTools::Hash.new.merge(a: { b: 2 }) } let(:h2) { PolishGeeks::DevTools::Hash.new.merge(a: { c: 3 }) } it { expect(subject).to be false } end end context 'when they have same structure but different data' do let(:h1) { PolishGeeks::DevTools::Hash.new.merge(a: { b: rand }) } let(:h2) { PolishGeeks::DevTools::Hash.new.merge(a: { b: rand }) } it { expect(subject).to be true } end end end
Version data entries
7 entries across 7 versions & 1 rubygems