aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/core_ext
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2012-11-13 11:11:11 -0800
committerAaron Patterson <aaron.patterson@gmail.com>2012-11-13 11:11:11 -0800
commit8f6ce1a17ea1d73c3becc16ece79046e113daf8e (patch)
tree6c6f78f12accdc433c64680d5d6117967b76c5c2 /activesupport/test/core_ext
parent9ad8d670ec53eab64f0e0f0a248c2b11ebd79cc8 (diff)
downloadrails-8f6ce1a17ea1d73c3becc16ece79046e113daf8e.tar.gz
rails-8f6ce1a17ea1d73c3becc16ece79046e113daf8e.tar.bz2
rails-8f6ce1a17ea1d73c3becc16ece79046e113daf8e.zip
backporting Struct#to_h from ruby 2.0
Diffstat (limited to 'activesupport/test/core_ext')
-rw-r--r--activesupport/test/core_ext/struct_test.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/activesupport/test/core_ext/struct_test.rb b/activesupport/test/core_ext/struct_test.rb
new file mode 100644
index 0000000000..0dff7b32d2
--- /dev/null
+++ b/activesupport/test/core_ext/struct_test.rb
@@ -0,0 +1,10 @@
+require 'abstract_unit'
+require 'active_support/core_ext/struct'
+
+class StructExt < ActiveSupport::TestCase
+ def test_to_h
+ x = Struct.new(:foo, :bar)
+ z = x.new(1, 2)
+ assert_equal({ foo: 1, bar: 2 }, z.to_h)
+ end
+end