Sha256: 4ee6f22096e6194ad7686f4ef3a431b0fbad32516dfea4c7c6bd337b11bc24bd
Contents?: true
Size: 1.37 KB
Versions: 56
Compression:
Stored size: 1.37 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
56 entries across 56 versions & 1 rubygems