Sha256: 8f781e15303e3d4d9875d835ee66461cf299a24742b7bd551461214157a672c1
Contents?: true
Size: 583 Bytes
Versions: 1
Compression:
Stored size: 583 Bytes
Contents
require 'spec_helper' describe 'Conditional transformations with Transproc' do describe 'guard' do let(:fn) { t(:guard, ->(value) { value.is_a?(::String) }, t(:to_integer)) } context 'when predicate returns truthy value' do it 'applies the transformation and returns the result' do input = '2' expect(fn[input]).to eql(2) end end context 'when predicate returns falsey value' do it 'returns the original value' do input = { 'foo' => 'bar' } expect(fn[input]).to eql('foo' => 'bar') end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
transproc-0.2.0 | spec/integration/conditional_spec.rb |