Sha256: ff9b1e7a67043caeac915ac609d525dca24e5b8d2394c5a1685bbb545e4ff81b

Contents?: true

Size: 861 Bytes

Versions: 12

Compression:

Stored size: 861 Bytes

Contents

require File.expand_path(File.dirname(__FILE__) + '/spec_helper')

describe String, "#snake_case" do
  it "lowercases one word CamelCase" do
    "Merb".snake_case.should == "merb"
  end

  it "makes one underscore snake_case two word CamelCase" do
    "MerbCore".snake_case.should == "merb_core"
  end

  it "handles CamelCase with more than 2 words" do
    "SoYouWantContributeToMerbCore".snake_case.should == "so_you_want_contribute_to_merb_core"
  end

  it "handles CamelCase with more than 2 capital letter in a row" do
    "CNN".snake_case.should == "cnn"
    "CNNNews".snake_case.should == "cnn_news"
    "HeadlineCNNNews".snake_case.should == "headline_cnn_news"
  end

  it "does NOT change one word lowercase" do
    "merb".snake_case.should == "merb"
  end

  it "leaves snake_case as is" do
    "merb_core".snake_case.should == "merb_core"
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
spreedly-1.3.5 vendor/httparty/spec/string_spec.rb
spreedly-1.3.4 vendor/httparty/spec/string_spec.rb
spreedly-1.3.3 vendor/httparty/spec/string_spec.rb
spreedly-1.3.2 vendor/httparty/spec/string_spec.rb
spreedly-1.3.1 vendor/httparty/spec/string_spec.rb
spreedly-1.0.1 vendor/httparty/spec/string_spec.rb
spreedly-1.0.0 vendor/httparty/spec/string_spec.rb
spreedly-1.1.0 vendor/httparty/spec/string_spec.rb
spreedly-1.3.0 vendor/httparty/spec/string_spec.rb
spreedly-1.2.1 vendor/httparty/spec/string_spec.rb
spreedly-1.2.2 vendor/httparty/spec/string_spec.rb
spreedly-1.2.0 vendor/httparty/spec/string_spec.rb