test/prepare_test.rb in representable-2.4.0.rc3 vs test/prepare_test.rb in representable-2.4.0.rc4
- old
+ new
@@ -16,14 +16,13 @@
end
describe "#to_hash" do # TODO: introduce :representable option?
representer! do
property :song,
- :prepare => lambda { |obj, args| args.binding[:arbitrary].new(obj) },
+ :prepare => lambda { |options| options[:binding][:arbitrary].new(options[:input]) },
:arbitrary => PreparerClass,
:extend => true,
- :pass_options => true,
:representable => false # don't call #to_hash.
end
let (:hit) { Struct.new(:song).new(song).extend(representer) }
@@ -45,10 +44,10 @@
describe "#from_hash" do
representer! do
property :song,
- :prepare => lambda { |obj, args| args.binding[:arbitrary].new(obj) },
+ :prepare => lambda { |options| options[:binding][:arbitrary].new(options[:input]) },
:arbitrary => PreparerClass,
#:extend => true, # TODO: typed: true would be better.
:instance => String.new, # pass_fragment
:pass_options => true,
:representable => false # don't call #to_hash.
\ No newline at end of file