Sha256: 5006a948a39cdc255f8f4d7f3f5038b32783c982954b0ec895b37f0aa5c8e3a1

Contents?: true

Size: 1.33 KB

Versions: 8

Compression:

Stored size: 1.33 KB

Contents

require 'spec_helper'

describe Jsus::Util::Inflection do
  subject { described_class }
  describe ".snake_case" do
    it "should convert HelloWorld into hello_world" do
      subject.snake_case("HelloWorld").should == "hello_world"
    end

    it "should convert hello_world into hello_world" do
      subject.snake_case("hello_world").should == "hello_world"
    end

    it "should convert 'hello world' into hello_world" do
      subject.snake_case("hello world").should == "hello_world"
    end
  end

  describe "#random_case_to_mixed_case" do
    it "should convert hello_world to HelloWorld" do
      subject.random_case_to_mixed_case("hello_world").should == "HelloWorld"
    end

    it "should convert Oh.My.God to OhMyGod" do
      subject.random_case_to_mixed_case("Oh.My.God").should == "OhMyGod"
    end

    it "should convert iAmCamelCase to IAmCamelCase" do
      subject.random_case_to_mixed_case("iAmCamelCase").should == "IAmCamelCase"
    end

    it "should convert some._Weird_..punctuation to SomeWeirdPunctuation" do
      subject.random_case_to_mixed_case("some._Weird_..punctuation").should == "SomeWeirdPunctuation"
    end
  end

  describe "#random_case_to_mixed_case_preserve_dots" do
    it "should preserve dots" do
      subject.random_case_to_mixed_case_preserve_dots("color.fx").should == "Color.Fx"
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
jsus-0.4.0 spec/jsus/util/inflection_spec.rb
jsus-0.3.6 spec/jsus/util/inflection_spec.rb
jsus-0.3.5 spec/jsus/util/inflection_spec.rb
jsus-0.3.4 spec/jsus/util/inflection_spec.rb
jsus-0.3.3 spec/jsus/util/inflection_spec.rb
jsus-0.3.2 spec/jsus/util/inflection_spec.rb
jsus-0.3.1 spec/jsus/util/inflection_spec.rb
jsus-0.3.0 spec/jsus/util/inflection_spec.rb