Sha256: a7546b8bb7963165c0e24cc0ced19358ac63a4f949058ddc11b3764eadcc2700

Contents?: true

Size: 879 Bytes

Versions: 2

Compression:

Stored size: 879 Bytes

Contents

require 'spec_helper'

describe CmykConverter do 
  describe ".matches?" do 
    it "should match args with cmyk hash" do 
      expect(CmykConverter.matches?(c: 87, m: 69, y: 13, k: 1)).to be true
    end

    it "should not match args without cmyk hash" do 
      expect(CmykConverter.matches?(h: 225, s: 73, v: 57)).to be false
    end
    
    it "should not match a string" do 
      expect(CmykConverter.matches?("#ffffff")).to be false
    end
  end
  
  describe ".rgba" do 
    it "should convert to rgba" do 
      conv = CmykConverter.new(c: 74, m: 58, y: 22, k: 3)
      rgba = {r: 64, g: 104, b: 193, a: 1.0}
      expect(conv.rgba).to eq rgba
    end

    it "should convert cymk strings to rgba" do 
      conv = CmykConverter.new(c: "74", m: "58", y: "22", k: "3")
      rgba = {r: 64, g: 104, b: 193, a: 1.0}
      expect(conv.rgba).to eq rgba
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
color_conversion-0.1.2 spec/converters/cmyk_converter_spec.rb
color_conversion-0.1.1 spec/converters/cmyk_converter_spec.rb