Sha256: 1c72a9fa2b5f14b3477d8c69d94d43952b657cc677aab8fc4da3e192eb485664

Contents?: true

Size: 1.28 KB

Versions: 2

Compression:

Stored size: 1.28 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
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
hazel-0.0.3 spec/string_extension_spec.rb
hazel-0.0.2 spec/string_extension_spec.rb