Created
February 1, 2016 23:53
-
-
Save claudiob/f2096db9d47e35d19ad2 to your computer and use it in GitHub Desktop.
HashWithIndifferentAccess#dig in Rails 5.0.0.beta2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment