Skip to content

Instantly share code, notes, and snippets.

@claudiob
Created February 1, 2016 23:53
Show Gist options
  • Save claudiob/f2096db9d47e35d19ad2 to your computer and use it in GitHub Desktop.
Save claudiob/f2096db9d47e35d19ad2 to your computer and use it in GitHub Desktop.

Revisions

  1. claudiob created this gist Feb 1, 2016.
    24 changes: 24 additions & 0 deletions hwia-dig.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,24 @@

    begin
    require 'bundler/inline'
    rescue LoadError => e
    $stderr.puts 'Bundler version 1.10 or later is required. Please update your Bundler'
    raise e
    end

    gemfile(true) do
    source 'https://rubygems.org'
    gem 'activesupport', '5.0.0.beta2' # NOTE: tests pass if replaced with 5.0.0.beta1
    end

    require 'active_support'
    require 'active_support/hash_with_indifferent_access'
    require 'active_support/core_ext/hash/indifferent_access'
    require 'minitest/autorun'

    class BugTest < Minitest::Test
    def test_hwia_dig
    data = {"this" => {"views" => 1234}}.with_indifferent_access
    assert_equal 1234, data.dig(:this, :views)
    end
    end