Sha256: 9778ebc65ed9773ffe215b04391da3d444c61815dcb1156574772573678879ac

Contents?: true

Size: 1.1 KB

Versions: 4

Compression:

Stored size: 1.1 KB

Contents

RSpec.describe "String#to_filename(substitute='_')" do

  it "should substitute all spaces with, by default, lowdashes" do 
    string = "this is a filename"
    expect(string.to_filename).to eq "this_is_a_filename"
  end

  it "should substitute all spaces with, if given, the substitute argument" do 
    string = "this is a filename"
    expect(string.to_filename('-')).to eq "this-is-a-filename"
  end

  it "should substitute all slashes with, by default, lowdashes" do 
    string = "this/is/a/filename"
    expect(string.to_filename).to eq "this_is_a_filename"
  end

  it "should substitute all slashes with, if given, the substitute argument" do 
    string = "this/is/a/filename"
    expect(string.to_filename('-')).to eq "this-is-a-filename"
  end

  it "should substitute all backslashes with, by default, lowdashes" do 
    string = 'this\is\a\filename'
    expect(string.to_filename).to eq "this_is_a_filename"
  end

  it "should substitute all backslashes with, if given, the substitute argument" do 
    string = 'this\is\a\filename'
    expect(string.to_filename('-')).to eq "this-is-a-filename"
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
eitil-1.2.4 spec/eitil_core/string/to_filename_spec.rb
eitil-1.2.3 spec/eitil_core/string/to_filename_spec.rb
eitil-1.2.2 spec/eitil_core/string/to_filename_spec.rb
eitil-1.2.1 spec/eitil_core/string/to_filename_spec.rb