Sha256: 8df9a86a1d4bf76509ea5eeed3567a948ea409cf081eb82db85b1472aa72b1dd

Contents?: true

Size: 868 Bytes

Versions: 1

Compression:

Stored size: 868 Bytes

Contents

require 'spec_helper'
require "subtitle"

describe "#Subtitle" do
  let(:o) do
    Subtitle
  end

  it "#hex2rgb" do
    result = o.send(:"hex2rgb", "0xff00ff")
    expect(result).to eq([255, 0, 255])
  end

  it "#decimal2hex" do
    result = o.send(:"decimal2hex", 10)
    expect(result).to eq('a')
  end

  it "#hex2decimal" do
    result = o.send(:"hex2decimal", "ff")
    expect(result).to eq(255)
  end

  describe "#translate" do
    it "'a' to 10" do
      result = o.send(:"translate", 'a')
      expect(result).to eq(10)
    end

    it "10 to 'a'" do
      result = o.send(:"translate", 10)
      expect(result).to eq('a')
    end
  end

  it "#rgb2hex" do
    result = o.send(:"rgb2hex" ,255,0,255)
    expect(result).to eq("#ff00ff")
  end

  it "#hex2rgb" do
    result = o.send(:"hex2rgb", "#ff00ff")
    expect(result).to eq([255, 0, 255])
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rrjj-0.0.1 spec/lib/subtitle_spec.rb