Sha256: 24124f7e30fa16b1294ad6a8aad75d06fa941dc78c66c66f1a3cf6f83f356d7a
Contents?: true
Size: 655 Bytes
Versions: 3
Compression:
Stored size: 655 Bytes
Contents
# require 'spec_helper' describe 'substr_count' do context 'different possible delimiters' do it 'returns count of commas as delimiter in a string' do expect("hello, hi, how, are you?".substr_count(",")).to eq(3) end it 'returns count of semi-colons as delimiter in a string' do expect("hello; hi, how, are you?".substr_count(";")).to eq(1) end it 'returns count of pipe as delimiter in a string' do expect("hello, hi| how| are you?".substr_count("|")).to eq(2) end it 'returns count of tab as delimiter in a string' do expect("hello\thi\thow| are you?".substr_count("\t")).to eq(2) end end end
Version data entries
3 entries across 3 versions & 1 rubygems