We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2976d35 commit 348eb42Copy full SHA for 348eb42
1 file changed
test/wrap_test.rb
@@ -67,9 +67,17 @@ class BandDecorator < Representable::Decorator
67
68
let (:band) { BandDecorator.prepare(Band.new("Social Distortion")) }
69
70
+ # direct, local api.
71
it do
72
band.to_hash.must_equal({"bands" => {"name"=>"Social Distortion"}})
73
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"
81
end
82
83
0 commit comments