Sha256: d9e11209a79aa154c26c17afbc9eb37370bcf21ad2c5a27fccebc2153ea97bec

Contents?: true

Size: 1.12 KB

Versions: 9

Compression:

Stored size: 1.12 KB

Contents

require File.dirname(__FILE__) + '/../spec_helper'
require 'aquarium/extensions/string'

describe  String, "#to_camel_case" do
  it "should return a camel-case string unchanged" do
    "CamelCaseString".to_camel_case.should == "CamelCaseString"
  end

  it "should return a camel-case string from an input string with substrings separated by underscores" do
    "camel_case_string".to_camel_case.should == "CamelCaseString"
  end

  it "should return a camel-case string with the first letters of each substring in uppercase and the rest of the letters in each substring unchanged" do
    "cAmEl_cASE_stRinG".to_camel_case.should == "CAmElCASEStRinG"
  end

  it "should remove leading and trailing underscores" do
    "camel_case_string_".to_camel_case.should    == "CamelCaseString"
    "_camel_case_string".to_camel_case.should    == "CamelCaseString"
    "camel_case_string__".to_camel_case.should   == "CamelCaseString"
    "__camel_case_string".to_camel_case.should   == "CamelCaseString"
    "_camel_case_string_".to_camel_case.should   == "CamelCaseString"
    "__camel_case_string__".to_camel_case.should == "CamelCaseString"
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
aquarium-0.7.1 spec/aquarium/extensions/string_spec.rb
aquarium-0.5.1 spec/aquarium/extensions/string_spec.rb
aquarium-0.4.4 spec/aquarium/extensions/string_spec.rb
aquarium-0.3.1 spec/aquarium/extensions/string_spec.rb
aquarium-0.4.1 spec/aquarium/extensions/string_spec.rb
aquarium-0.4.2 spec/aquarium/extensions/string_spec.rb
aquarium-0.3.0 spec/aquarium/extensions/string_spec.rb
aquarium-0.4.0 spec/aquarium/extensions/string_spec.rb
aquarium-0.4.3 spec/aquarium/extensions/string_spec.rb