File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22
33## Unreleased
44
5+ ### Bug fixes
6+
7+ * Added alias to_h for to_hash ([ #277 ] ( https://github.com/railsconfig/config/issues/277 ) )
8+
59### Changes
610
711* Add JRuby 9.2 to the test matrix ([ #228 ] ( https://github.com/railsconfig/config/issues/228 ) )
Original file line number Diff line number Diff line change @@ -118,6 +118,8 @@ def to_hash
118118 result
119119 end
120120
121+ alias :to_h :to_hash
122+
121123 def each ( *args , &block )
122124 marshal_dump . each ( *args , &block )
123125 end
Original file line number Diff line number Diff line change 8080 expect ( config [ :section ] [ :servers ] [ 1 ] ) . to be_kind_of ( Config ::Options )
8181 end
8282
83+ it "should convert to a hash without modifying nested settings" do
84+ config = Config . load_files ( "#{ fixture_path } /development.yml" )
85+ config . to_h
86+ expect ( config ) . to be_kind_of ( Config ::Options )
87+ expect ( config [ :section ] ) . to be_kind_of ( Config ::Options )
88+ expect ( config [ :section ] [ :servers ] [ 0 ] ) . to be_kind_of ( Config ::Options )
89+ expect ( config [ :section ] [ :servers ] [ 1 ] ) . to be_kind_of ( Config ::Options )
90+ end
91+
8392 it "should convert to a json" do
8493 config = Config . load_files ( "#{ fixture_path } /development.yml" ) . to_json
8594 expect ( JSON . parse ( config ) [ "section" ] [ "servers" ] ) . to be_kind_of ( Array )
You can’t perform that action at this time.
0 commit comments