Skip to content

Instantly share code, notes, and snippets.

@vrinek
Last active August 29, 2015 13:59
Show Gist options
  • Select an option

  • Save vrinek/10476447 to your computer and use it in GitHub Desktop.

Select an option

Save vrinek/10476447 to your computer and use it in GitHub Desktop.
require 'active_support/hash_with_indifferent_access'
require 'minitest/autorun'
def sum(a: 0, b: 0)
a + b
end
class BugTest < MiniTest::Unit::TestCase
def setup
@normal_hash = {a: 18, b: 24} # just a hash
@indiff_hash = ActiveSupport::HashWithIndifferentAccess.new(@normal_hash)
end
def test_ruby_hash
assert_equal 42, sum(@normal_hash)
end
def test_hash_with_indifferent_access
assert_equal 42, sum(@indiff_hash)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment