Sha256: e51a3d3c7baa9e7e18b294f78dfb0d2cde3fe0c668a20e0b0ebd415470ed5a8b

Contents?: true

Size: 940 Bytes

Versions: 8

Compression:

Stored size: 940 Bytes

Contents

require 'test_helper'

require File.join(File.dirname(__FILE__), '..', 'lib/cliutils/ext/string_extensions')

# Tests for the String extension methods
class TestStringExtensions < Test::Unit::TestCase
  def test_custom_colors
    assert_output("\e[34mtest\e[0m") { print 'test'.blue }
    assert_output("\e[36mtest\e[0m") { print 'test'.cyan }
    assert_output("\e[32mtest\e[0m") { print 'test'.green }
    assert_output("\e[35mtest\e[0m") { print 'test'.purple }
    assert_output("\e[31mtest\e[0m") { print 'test'.red }
    assert_output("\e[37mtest\e[0m") { print 'test'.white }
    assert_output("\e[33mtest\e[0m") { print 'test'.yellow }
  end
  
  def test_colorize
    assert_output("\e[35;42mtest\e[0m") { print 'test'.colorize('35;42') }
  end

  def test_camelize
    assert_output('TestString') { print 'test_string'.camelize }
  end

  def test_snakify
    assert_output('test_string') { print 'TestString'.snakify }
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
cliutils-2.1.4 test/string_extesions_test.rb
cliutils-2.1.3 test/string_extesions_test.rb
cliutils-2.1.2 test/string_extesions_test.rb
cliutils-2.1.1 test/string_extesions_test.rb
cliutils-2.1.0 test/string_extesions_test.rb
cliutils-2.0.3 test/string_extesions_test.rb
cliutils-2.0.2 test/string_extesions_test.rb
cliutils-2.0.1 test/string_extesions_test.rb