Sha256: 75880f49c037cfbe67132af52e94437b26ea6886752547540c305d4c8b25825e

Contents?: true

Size: 863 Bytes

Versions: 1

Compression:

Stored size: 863 Bytes

Contents

#!/usr/bin/env ruby

# propercase.rb
# String#propercase unit tests

require 'test/unit'

require 'pathname'
dir = Pathname.new(File.expand_path(__FILE__)).realpath
require File.join(File.dirname(dir.to_s), '../lib/rex')

class ProperCaseTests < Test::Unit::TestCase
  def test_empty_string
    expected = ''
    actual = nil

    assert_nothing_raised do
      actual = ''.propercase
    end

    assert_not_nil(actual)
    assert_instance_of(String, actual)
    assert_equal(true, actual.empty?)
    assert_equal(expected, actual)
  end

  def test_regular_string
    expected = 'Ruby Extension Library'
    actual = nil

    assert_nothing_raised do
      actual = 'rUby eXtension lIbrAry'.propercase
    end

    assert_not_nil(actual)
    assert_instance_of(String, actual)
    assert_equal(false, actual.empty?)
    assert_equal(expected, actual)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rex-0.0.4 test/propercase.rb