Sha256: fa21edaf8b89cb4836f45180ad7edb3235af754c595c64fce00fa89f7be36308

Contents?: true

Size: 655 Bytes

Versions: 6

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

6 entries across 6 versions & 1 rubygems

Version Path
csv-import-analyzer-0.0.9 spec/csv-import-analyzer/helpers/string_class_extension_spec.rb
csv-import-analyzer-0.0.8 spec/csv-import-analyzer/helpers/string_class_extension_spec.rb
csv-import-analyzer-0.0.7 spec/csv-import-analyzer/helpers/string_class_extension_spec.rb
csv-import-analyzer-0.0.6 spec/csv-import-analyzer/helpers/string_class_extension_spec.rb
csv-import-analyzer-0.0.5 spec/csv-import-analyzer/helpers/string_class_extension_spec.rb
csv-import-analyzer-0.0.4 spec/csv-import-analyzer/helpers/string_class_extension_spec.rb