Sha256: 03efb4e3ace380909de0cc65722835a6015a0dc82a31b88775e039984685e848
Contents?: true
Size: 1.18 KB
Versions: 4
Compression:
Stored size: 1.18 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{ asdf } expect(input.to_list).to eq '"asdf"' 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{ asdf asdf asdf} expect(input.to_list).to eq '"asdf", "asdf", "asdf"' end it 'supports to change the last separator' do input = %w{ asdf asdf asdf} expect(input.to_list(last_separator: ' or ')).to eq '"asdf", "asdf" or "asdf"' end it 'supports to change the separator' do input = %w{ asdf asdf asdf} expect(input.to_list(separator: ':')).to eq '"asdf":"asdf":"asdf"' end it 'change multiple things' do input = %w{ asdf asdf asdf} expect(input.to_list(around: '', separator: ':')).to eq 'asdf:asdf:asdf' end it 'supports to change the string to surround items' do input = %w{ asdf asdf asdf} expect(input.to_list(around: '$')).to eq '$asdf$, $asdf$, $asdf$' end end end
Version data entries
4 entries across 4 versions & 1 rubygems