Sha256: 4d7368384cac61dd354862d3aa7e367981aedad91f0146cab4ed908f19add422

Contents?: true

Size: 693 Bytes

Versions: 11

Compression:

Stored size: 693 Bytes

Contents

# encoding: utf-8
#
# This file is part of the lazier gem. Copyright (C) 2013 and above Shogun <shogun_panda@me.com>.
# Licensed under the MIT license, which can be found at http://www.opensource.org/licenses/mit-license.php.
#

require "spec_helper"

describe Lazier::Hash do
  let(:reference) {
    rv = {a: 1, "b" => {c: 2, d: {"e" => 3}}}
    rv.default = 0
    rv
  }

  before(:each) do
    ::Lazier.load!
  end

  describe "allows access to keys using dotted notation" do
    it "should allow method reference for symbol key" do
      reference.b.f = 4

      expect(reference.a).to eq(1)
      expect(reference.b.c).to eq(2)
      expect(reference["b"]["f"]).to eq(4)
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
lazier-3.2.7 spec/lazier/hash_spec.rb
lazier-3.2.6 spec/lazier/hash_spec.rb
lazier-3.2.5 spec/lazier/hash_spec.rb
lazier-3.2.4 spec/lazier/hash_spec.rb
lazier-3.2.3 spec/lazier/hash_spec.rb
lazier-3.2.2 spec/lazier/hash_spec.rb
lazier-3.2.1 spec/lazier/hash_spec.rb
lazier-3.2.0 spec/lazier/hash_spec.rb
lazier-3.1.0 spec/lazier/hash_spec.rb
lazier-3.0.1 spec/lazier/hash_spec.rb
lazier-3.0.0 spec/lazier/hash_spec.rb