spec/windcharger/hash_transformer_spec.rb in windcharger-0.4.0 vs spec/windcharger/hash_transformer_spec.rb in windcharger-0.5.0
- old
+ new
@@ -35,7 +35,19 @@
end
transformer = transformer_class.new
expect { transformer.transform }.to raise_error NoMethodError, /private/
end
+
+ it "calls overridden transform via to_h" do
+ transformer_class = Class.new do
+ extend Windcharger::Attributes
+ include Windcharger::HashTransformer
+
+ def transform; :foo; end
+ end
+ transformer = transformer_class.new
+
+ expect(transformer.to_h).to eq :foo
+ end
end
end