spec/unit/function_spec.rb in transproc-1.0.0 vs spec/unit/function_spec.rb in transproc-1.0.1
- old
+ new
@@ -96,9 +96,24 @@
fn = container.t(:to_string)
expect(fn[:ok]).to eql('ok')
expect(fn.to_ast).to eql([:to_string, []])
end
+
+ it 'plays well with functions as arguments' do
+ container.register(:map_array, Transproc::ArrayTransformations.t(:map_array))
+ container.register(:to_symbol, Transproc::Coercions.t(:to_symbol))
+ fn = container.t(:map_array, container.t(:to_symbol))
+
+ expect(fn.call(%w(a b c))).to eql([:a, :b, :c])
+ expect(fn.to_ast).to eql(
+ [
+ :map_array, [
+ [:to_symbol, []]
+ ]
+ ]
+ )
+ end
end
describe '#==' do
let(:fns) do
Module.new do