Sha256: c6d0c53c959cc54757715c60d6d70e6f2c5797e4446a677ad203a3961d04f7ae

Contents?: true

Size: 869 Bytes

Versions: 19

Compression:

Stored size: 869 Bytes

Contents

require "spec_helper"

describe String do

  describe "#snakecase" do
    it "lowercases one word CamelCase" do
      "Merb".snakecase.should == "merb"
    end

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

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

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

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

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

end

Version data entries

19 entries across 19 versions & 4 rubygems

Version Path
vagrant-tiktalik-0.0.3 vendor/bundle/ruby/2.0.0/gems/nori-1.1.5/spec/nori/core_ext/string_spec.rb
nori-2.4.0 spec/nori/core_ext/string_spec.rb
nori-ng-1.6-2.3.0 spec/nori/core_ext/string_spec.rb
nori-2.3.0 spec/nori/core_ext/string_spec.rb
nori-2.2.0 spec/nori/core_ext/string_spec.rb
nori-2.1.0 spec/nori/core_ext/string_spec.rb
nori-1.1.5 spec/nori/core_ext/string_spec.rb
nori-2.0.4 spec/nori/core_ext/string_spec.rb
nori-1.1.4 spec/nori/core_ext/string_spec.rb
nori-1.0.3 spec/nori/core_ext/string_spec.rb
nori-2.0.3 spec/nori/core_ext/string_spec.rb
nori-2.0.0 spec/nori/core_ext/string_spec.rb
nori-1.1.3 spec/nori/core_ext/string_spec.rb
nori-1.1.2 spec/nori/core_ext/string_spec.rb
nori-1.1.0 spec/nori/core_ext/string_spec.rb
nori-1.0.2 spec/nori/core_ext/string_spec.rb
search_biomodel-1.0.0 search_biomodel/ruby/1.8/gems/nori-1.0.1/spec/nori/core_ext/string_spec.rb
nori-1.0.1 spec/nori/core_ext/string_spec.rb
nori-1.0.0 spec/nori/core_ext/string_spec.rb