Sha256: 79eb4d1f1b974b29fbb6d61805fdef7ecc60454a6c1f3be5e23c67457f08d17d
Contents?: true
Size: 920 Bytes
Versions: 1
Compression:
Stored size: 920 Bytes
Contents
require 'to_proc/refine/array' using ToProc::Refine::Array describe ToProc::Refine::Array do describe 'when the size is 2' do it 'has a special proc when the first element is a Symbol' do array_of_arrays = [[:a, :b, :c], [:b, :c, :d], [:e, :f, :g]] arrays_which_include_a = array_of_arrays.select &[:include?, :a] expect(arrays_which_include_a).to eq [[:a, :b, :c]] end it 'has a special proc when the second element is a Symbol' do array = [:a, :b, :c] another_array = [1, :a, 2, :c, :d].select &[array, :include?] expect(another_array).to eq [:a, :c] end end describe 'when of any size' do it 'has a special proc' do proc0 = -> first, second, third { "#{first}#{second}#{third}" } proc1 = proc { |first| first } array = [proc0, proc1] result = array.map &[:a, :b, :c] expect(result).to eq ['abc', :a] end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
to_proc-0.0.8 | spec/refine/array_spec.rb |