Sha256: dc41294cccc6b7a268818af67e5613d4205eb67c79ed3332c853645e80ab9472

Contents?: true

Size: 842 Bytes

Versions: 9

Compression:

Stored size: 842 Bytes

Contents

require 'rib/test'
require 'rib/more/color'

describe Rib::Color do
  behaves_like :rib

  before do
    @color = Class.new do
      include Rib::Color
      def colors
        @colors ||= Rib::Shell.new.before_loop.config[:color]
      end
    end.new
  end

  should 'give correct color' do
    @color.send(:format_color,
      [{0 => :a}, 'b', [nil, {false => Object}], {true => Exception.new}]).
        should.eq \
          "\e[34m[\e[m\e[34m{\e[m\e[31m0\e[m\e[34m=>\e[m\e[36m:a\e[m\e[" \
          "34m}\e[m\e[34m, \e[m\e[32m\"b\"\e[m\e[34m, \e[m\e[34m[\e[m\e" \
          "[35mnil\e[m\e[34m, \e[m\e[34m{\e[m\e[35mfalse\e[m\e[34m=>\e[" \
          "m\e[33mObject\e[m\e[34m}\e[m\e[34m]\e[m\e[34m, \e[m\e[34m{\e" \
          "[m\e[35mtrue\e[m\e[34m=>\e[m\e[35m#<Exception: Exception>\e[" \
          "m\e[34m}\e[m\e[34m]\e[m"
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
rib-0.9.5 test/more/test_color.rb
rib-0.9.5.pre.1 test/more/test_color.rb
rib-0.9.5.pre.0 test/more/test_color.rb
rib-0.9.4 test/more/test_color.rb
rib-0.9.3 test/more/test_color.rb
rib-0.9.2 test/more/test_color.rb
rib-0.9.1 test/more/test_color.rb
rib-0.9.0 test/more/test_color.rb
rib-0.1.0 test/more/test_color.rb