Sha256: e8b864a463bcdb318b4e2e8c7c86e55bac15d6ecf0503d72047f7b18dda5b8d3

Contents?: true

Size: 833 Bytes

Versions: 2

Compression:

Stored size: 833 Bytes

Contents

require File.expand_path('../../test_helper', __FILE__)

class SupportTest < Test::Unit::TestCase
  context 'Hash' do
    setup do
      @hash_str = {'hello' => 'world'}
      @hash_sym = {:hello  => 'world'}
    end

    should 'be able to symbolize keys' do
      assert_equal @hash_sym, @hash_str.symbolize_keys
      @hash_str.symbolize_keys!
      assert_equal @hash_sym, @hash_str
    end

    should 'provide methods for its keys through method_missing' do
      assert_equal 'world', @hash_str.hello
      assert_equal 'world', @hash_sym.hello
    end
  end

  context 'String' do
    should 'be able to colorize itself' do
      str = 'foo'
      String::COLORS.each_with_index do |color, i|
        assert str.colorize(color)
        assert_equal "\e[0;#{30+i}m#{str}\e[0m", str.colorize(color)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
aurb-1.4.1 test/unit/support_test.rb
aurb-1.4.0 test/unit/support_test.rb