Sha256: 803d3c56c85262d333816384a36eea96ddc97a13a6521827b1b2d8009652ada6
Contents?: true
Size: 899 Bytes
Versions: 7
Compression:
Stored size: 899 Bytes
Contents
# frozen_string_literal: true require 'spec_helper' describe ::Array do let(:array) { [1, 'value1', 'value2', { key1: 'value1', 'key2' => 'value2' }, %w[key1 key2]] } describe '.stringify_keys' do it 'converts string keys to strings' do result = array.stringify_keys expect(result).to eq([1, 'value1', 'value2', { 'key1' => 'value1', 'key2' => 'value2' }, %w[key1 key2]]) end end describe '.abbr_choices' do it 'abbreviates the choices' do arr = ['(o)ption 1', '(s)econd option', '(t)hird option'] result = arr.abbr_choices expect(result).to match(%r{{xdw}\[{xbw}o{dw}/{xbw}s{dw}/{xbw}t{dw}\]{x}}) end it 'handles a default' do arr = ['(o)ption 1', '(s)econd option', '(t)hird option'] result = arr.abbr_choices(default: 'o') expect(result).to match(%r{{xdw}\[{xbc}o{dw}/{xbw}s{dw}/{xbw}t{dw}\]{x}}) end end end
Version data entries
7 entries across 7 versions & 1 rubygems