Sha256: c7ff8c634ec337efd0e669ad177bc49612c3809aa25986a95a952c49e0a35121

Contents?: true

Size: 1.73 KB

Versions: 1

Compression:

Stored size: 1.73 KB

Contents

require File.expand_path("../../../../test_helper.rb", __FILE__)

module Core
  module String
    class InflectionsTest < ActiveSupport::TestCase

      test "upcase_first" do
        assert_equal      "",      "".upcase_first
        assert_equal "Value", "value".upcase_first
        assert_equal "VALUE", "vALUE".upcase_first
        assert_equal "Value", "Value".upcase_first
      end

      test "cp_case" do
        assert_equal                  "VALUE",                  "value".cp_case("KEY")
        assert_equal                  "value",                  "VALUE".cp_case("key")
        assert_equal                  "VAlUe",                  "vAlUe".cp_case("Key")
        assert_equal "Welkom bij CodeHero.es", "welkom bij CodeHero.es".cp_case("Welcome at CodeHero.es")
      end

      test "upcase_first!" do
        assert_equal    nil,     "".upcase_first!
        assert_equal    nil, "Paul".upcase_first!
        assert_equal "Paul", "paul".upcase_first!
      end

      test "cp_case!" do
        assert_equal    nil,     "".cp_case!("")
        assert_equal    nil, "Paul".cp_case!("Engel")
        assert_equal    nil, "PAUL".cp_case!("ENGEL")
        assert_equal "Paul", "paul".cp_case!("Engel")
        assert_equal "PAUL", "paul".cp_case!("ENGEL")
      end

      test "singularize!" do
        assert_equal    nil, "test" .singularize!
        assert_equal    nil, "TeSt" .singularize!
        assert_equal "test", "tests".singularize!
        assert_equal "TeSt", "TeSts".singularize!
      end

      test "pluralize!" do
        assert_equal     nil, "tests".pluralize!
        assert_equal     nil, "TeSts".pluralize!
        assert_equal "tests", "test" .pluralize!
        assert_equal "TeSts", "TeSt" .pluralize!
      end

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rich_support-0.1.0 suit/shared/test/unit/core/string/inflections_test.rb