Sha256: ef0a64ac070c3ac147ca4f3320e93939d426ef99ef78813a9b2c505b22c6c711

Contents?: true

Size: 1.05 KB

Versions: 1

Compression:

Stored size: 1.05 KB

Contents

# encoding: utf-8
require "spec_helper"

describe Comfan do
  subject { described_class }

  describe ".api_id" do
    it "returns the same ID for API ID" do
      input = "752S00000000KtkIAE"
      expect(subject.api_id(input)).to eq(input)
    end

    it "returns the correct API ID for UI ID" do
      input = "752S00000000Ktk"
      output = "752S00000000KtkIAE"
      expect(subject.api_id(input)).to eq(output)
    end

    it "returns nil for nil input" do
      expect(subject.api_id(nil)).to be_nil
    end

    it "returns same ID if too short" do
      input = "752S00000000"
      expect(subject.api_id(input)).to eq(input)
    end
  end

  describe ".ui_id" do
    it "returns the same ID for UI ID" do
      input = "752S00000000Ktk"
      expect(subject.ui_id(input)).to eq(input)
    end

    it "returns the correct UI ID for API ID" do
      input = "752S00000000KtkIAE"
      output = "752S00000000Ktk"
      expect(subject.ui_id(input)).to eq(output)
    end

    it "returns nil for nil input" do
      expect(subject.ui_id(nil)).to be_nil
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
comfan-0.1.2 spec/lib/comfan_spec.rb