Sha256: 374997cbe5e9b899da1867563615c05b699ef582af15ba7730b11d3fcf9eb585

Contents?: true

Size: 1.45 KB

Versions: 19

Compression:

Stored size: 1.45 KB

Contents

require_relative "spec_helper"
require_relative "../lib/extensions/string.rb"

describe String do
  it "should ignore an already camel cased string" do
    "MyApp".camel_case.must_equal "MyApp"
  end

  it "should capitalize an all lower case string" do
    "myapp".camel_case.must_equal "Myapp"
  end

  it "should camel case a lower case string with underscores" do
    "my_app".camel_case.must_equal "MyApp"
  end

  it "should camel case a lower case string with hyphens" do
    "my-app".camel_case.must_equal "MyApp"
  end

  it "should camel case an uppercase string with underscores" do
    "MY_APP".camel_case.must_equal "MyApp"
  end

  it "should camel case an uppercase string with hyphens" do
    "MY-APP".camel_case.must_equal "MyApp"
  end

  it "should camel case a string with a hyphen preceding a capital letter" do
    "my_App".camel_case.must_equal "MyApp"
  end

  it "should underscore a camel cased string" do
    "MyApp".file_name.must_equal "my_app"
  end

  it "should underscore a hypenated string" do
    "my-app".file_name.must_equal "my_app"
  end

  it "should ignore an already underscored string" do
    "my_app".file_name.must_equal "my_app"
  end

  it "should_underscore_a_string_with_a_hyphen_preceding_a_capital_letter" do
    "my_App".file_name.must_equal "my_app"
  end

  it "should allow dashes in directory names, but not in filenames" do
    "my-App".directory_name.must_equal "my-app"
    "my-App".file_name.must_equal "my_app"
  end
end

Version data entries

19 entries across 19 versions & 3 rubygems

Version Path
corneal-new-1.3.1 spec/string_extension_spec.rb
corneal-new-1.3.0 spec/string_extension_spec.rb
corneal-1.2.3 spec/string_extension_spec.rb
corneal-1.2.2 spec/string_extension_spec.rb
corneal-1.2.1 spec/string_extension_spec.rb
corneal-1.2.0 spec/string_extension_spec.rb
corneal-1.1.0 spec/string_extension_spec.rb
corneal-1.0.0 spec/string_extension_spec.rb
corneal-0.1.5 spec/string_extension_spec.rb
corneal-0.1.4 spec/string_extension_spec.rb
corneal-0.1.3 spec/string_extension_spec.rb
corneal-0.1.2 spec/string_extension_spec.rb
corneal-0.1.1 spec/string_extension_spec.rb
corneal-0.1.0 spec/string_extension_spec.rb
hazel-0.0.8 spec/string_extension_spec.rb
hazel-0.0.7 spec/string_extension_spec.rb
hazel-0.0.6 spec/string_extension_spec.rb
hazel-0.0.5 spec/string_extension_spec.rb
hazel-0.0.4 spec/string_extension_spec.rb