Sha256: cd263778c12e79cdf6809bd8df577ee5434c98f75d2ff93262787ccece566287

Contents?: true

Size: 495 Bytes

Versions: 2

Compression:

Stored size: 495 Bytes

Contents

require 'test/unit'
require 'iz'

class TestHexColor < Test::Unit::TestCase

  def valid_hex_colors
    ['#123', '#1bc', '#AB9', '#888aaa']
  end

  def invalid_hex_colors
    [nil, false, -1, '', '    ', 'g', '#1234']
  end

  def test_that_hex_color_values_return_true
    valid_hex_colors.each do |hex|
      assert Iz.hex_color?(hex)
    end
  end

  def test_that_invalid_hex_color_values_return_false
    invalid_hex_colors.each do |hex|
      assert !Iz.hex_color?(hex)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
iz-0.3.1 test/test_hex_color.rb
iz-0.3.0 test/test_hex_color.rb