Sha256: af91d340872c343f0cd1def79fd5e0d33d46a4021b2ed05b08b58462478afbec

Contents?: true

Size: 704 Bytes

Versions: 1

Compression:

Stored size: 704 Bytes

Contents

require 'spec_helper'

describe NameConverter do 
  describe ".matches?" do 
    it "should match args with name string" do 
      expect(NameConverter.matches?("blue")).to be_true
    end

    it "should match args with color insensitive string" do 
      expect(NameConverter.matches?("RoyalBlue")).to be_true
      expect(NameConverter.matches?("royalblue")).to be_true
    end

    it "should not match args without name string" do 
      expect(NameConverter.matches?("#ffffff")).to be_false
    end
  end
  
  describe ".rgb" do 
    it "should convert to rgb" do 
      conv = NameConverter.new("blue")
      rgba = {r: 0, g: 0, b: 255, a: 1.0}
      expect(conv.rgba).to eq rgba
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
color_conversion-0.1.0 spec/converters/name_converter_spec.rb