Sha256: 3961b0521527355edb1e6fc8207083ec0760925b7770f08151a1be159a92ef02

Contents?: true

Size: 990 Bytes

Versions: 31

Compression:

Stored size: 990 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

    it "converts period characters to underscores" do
      "User.GetEmail".snakecase.should == "user_get_email"
    end
  end

end

Version data entries

31 entries across 31 versions & 6 rubygems

Version Path
vagrant-tiktalik-0.0.3 vendor/bundle/ruby/2.0.0/gems/savon-0.9.5/spec/savon/core_ext/string_spec.rb
savon-2.5.1 spec/savon/core_ext/string_spec.rb
savon-2.5.0 spec/savon/core_ext/string_spec.rb
savon_with_adapter-2.4.1 spec/savon/core_ext/string_spec.rb
savon-2.4.0 spec/savon/core_ext/string_spec.rb
savon-2.3.3 spec/savon/core_ext/string_spec.rb
savon-2.3.2 spec/savon/core_ext/string_spec.rb
savon-2.3.1 spec/savon/core_ext/string_spec.rb
savon-ng-1.6-2.4.1 spec/savon/core_ext/string_spec.rb
savon-ng-1.6-2.4.0 spec/savon/core_ext/string_spec.rb
savon-2.3.0 spec/savon/core_ext/string_spec.rb
savon-2.2.0 spec/savon/core_ext/string_spec.rb
savon-2.1.0 spec/savon/core_ext/string_spec.rb
savon-2.0.3 spec/savon/core_ext/string_spec.rb
savon-2.0.2 spec/savon/core_ext/string_spec.rb
savon-2.0.1 spec/savon/core_ext/string_spec.rb
savon-2.0.0 spec/savon/core_ext/string_spec.rb
savon-1.2.0 spec/savon/core_ext/string_spec.rb
savon-1.1.0 spec/savon/core_ext/string_spec.rb
savon-1.0.0 spec/savon/core_ext/string_spec.rb