Sha256: 0e88215c5aa67467e723773d35ede45722870327e54beafcdae5f0eade314141

Contents?: true

Size: 716 Bytes

Versions: 2

Compression:

Stored size: 716 Bytes

Contents

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

2 entries across 2 versions & 1 rubygems

Version Path
camalian-0.0.3 test/test_color.rb
camalian-0.0.2 test/test_color.rb