Sha256: 6fc375af00cb6b0edcc91e65fb70ecca70d2a88104ec1ec70788762b85844ebb

Contents?: true

Size: 1.12 KB

Versions: 6

Compression:

Stored size: 1.12 KB

Contents

require File.dirname(__FILE__) + '/../spec_helper.rb'
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

6 entries across 6 versions & 1 rubygems

Version Path
aquarium-0.1.6 spec/aquarium/extensions/string_spec.rb
aquarium-0.1.7 spec/aquarium/extensions/string_spec.rb
aquarium-0.1.8 spec/aquarium/extensions/string_spec.rb
aquarium-0.2.0 spec/aquarium/extensions/string_spec.rb
aquarium-0.1.0 spec/aquarium/extensions/string_spec.rb
aquarium-0.1.5 spec/aquarium/extensions/string_spec.rb