Sha256: bdf4150fe1bafcad7bb53fc5b9ffafcd286030195edd82af868568e34a645820

Contents?: true

Size: 783 Bytes

Versions: 5

Compression:

Stored size: 783 Bytes

Contents

# frozen_string_literal: true

require 'test_helper'
require 'minitest/autorun'
require 'minitest/spec'
require 'camalian'

describe Camalian::Color do
  before do
    @color = Camalian::Color.new(120, 255, 30)
  end

  describe 'Color initialized with 120, 255, 30 rgb values' do
    it 'hex value must be #78ff1e' do
      _(@color.to_hex).must_equal '#78ff1e'
    end

    it 'hsl color components must ' do
      _([@color.h.to_i, @color.s.to_i, @color.l.to_i]).must_equal [96, 100, 55]
    end

    it 'hsv color components must ' do
      _(@color.hsv.map(&:to_i)).must_equal [96, 88, 100]
    end
  end

  describe 'initialized with 1 integer rgb value' do
    it 'must have leading zero' do
      _(Camalian::Color.new(7, 7, 7).to_hex).must_equal '#070707'
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
camalian-0.2.2 test/color_test.rb
camalian-0.2.1 test/color_test.rb
camalian-0.2.0 test/color_test.rb
camalian-0.1.1 test/test_color.rb
camalian-0.1.0 test/test_color.rb