Skip to content

Commit 348eb42

Browse files
committed
more tests for passing :wrap into to_/from_hash.
1 parent 2976d35 commit 348eb42

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

test/wrap_test.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,17 @@ class BandDecorator < Representable::Decorator
6767

6868
let (:band) { BandDecorator.prepare(Band.new("Social Distortion")) }
6969

70+
# direct, local api.
7071
it do
7172
band.to_hash.must_equal({"bands" => {"name"=>"Social Distortion"}})
7273
band.to_hash(wrap: false).must_equal({"name"=>"Social Distortion"})
74+
band.to_hash(wrap: :band).must_equal(:band=>{"name"=>"Social Distortion"})
75+
end
76+
77+
it do
78+
band.from_hash({"bands" => {"name"=>"Social Distortion"}}).name.must_equal "Social Distortion"
79+
band.from_hash({"name"=>"Social Distortion"}, wrap: false).name.must_equal "Social Distortion"
80+
band.from_hash({band: {"name"=>"Social Distortion"}}, wrap: :band).name.must_equal "Social Distortion"
7381
end
7482

7583

0 commit comments

Comments
 (0)