Sha256: 2daa366ee96263fc8667180f150f8a21bdd3cc168ebf33be77330bb77eff0756
Contents?: true
Size: 1.38 KB
Versions: 3
Compression:
Stored size: 1.38 KB
Contents
# encoding: utf-8 require 'spec_helper' require 'fedux_org_stdlib/core_ext/array/list' RSpec.describe Array do context '#to_list' do it 'handles single value' do input = %w{ test } expect(input.to_list).to eq '"test"' end it 'handles two values' do input = %w{ test1 test2 } expect(input.to_list).to eq '"test1", "test2"' end it 'converts array to a list of values' do input = %w{ test1 test2 test3 } expect(input.to_list).to eq '"test1", "test2", "test3"' end it 'converts array to a list of values' do input = %w{ test1 test2 test3 test4 } expect(input.to_list).to eq '"test1", "test2", "test3", "test4"' end it 'supports to change the last separator' do input = %w{ test1 test2 test3} expect(input.to_list(last_separator: ' or ')).to eq '"test1", "test2" or "test3"' end it 'supports to change the separator' do input = %w{ test1 test2 test3} expect(input.to_list(separator: ':')).to eq '"test1":"test2":"test3"' end it 'change multiple things' do input = %w{ test1 test2 test3} expect(input.to_list(around: '', separator: ':')).to eq 'test1:test2:test3' end it 'supports to change the string to surround items' do input = %w{ test1 test2 test3} expect(input.to_list(around: '$')).to eq '$test1$, $test2$, $test3$' end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
fedux_org-stdlib-0.7.21 | spec/core_ext/array/list_spec.rb |
fedux_org-stdlib-0.7.20 | spec/core_ext/array/list_spec.rb |
fedux_org-stdlib-0.7.19 | spec/core_ext/array/list_spec.rb |