Sha256: 7d3611fa9a1a4fda81379da14731c08e0602a9e5bc64a1efc39eee3eb50bcfd1

Contents?: true

Size: 690 Bytes

Versions: 10

Compression:

Stored size: 690 Bytes

Contents

require 'spec_helper'

describe Transproc::Composer do
  before do
    module Foo
      extend Transproc::Registry
      import Transproc::ArrayTransformations
      import Transproc::HashTransformations
      import Transproc::Coercions
    end
  end

  subject(:object) do
    Class.new do
      include Transproc::Composer

      def fn
        compose do |fns|
          fns << Foo[:map_array, Foo[:symbolize_keys]] <<
            Foo[:map_array, Foo[:map_value, :age, Foo[:to_integer]]]
        end
      end
    end.new
  end

  it 'allows composing functions' do
    expect(object.fn[[{ 'age' => '12' }]]).to eql([{ age: 12 }])
  end

  after { Object.send :remove_const, :Foo }
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
transproc-1.0.3 spec/unit/composer_spec.rb
transproc-1.0.2 spec/unit/composer_spec.rb
transproc-1.0.1 spec/unit/composer_spec.rb
transproc-1.0.0 spec/unit/composer_spec.rb
transproc-0.4.2 spec/unit/composer_spec.rb
transproc-0.4.1 spec/unit/composer_spec.rb
transproc-0.4.0 spec/unit/composer_spec.rb
transproc-0.3.2 spec/unit/composer_spec.rb
transproc-0.3.1 spec/unit/composer_spec.rb
transproc-0.3.0 spec/unit/composer_spec.rb