Sha256: b3bb7456a5ba712ac7e553f5734d078f76b748b3761a9dad64624cc9fec380a3

Contents?: true

Size: 964 Bytes

Versions: 1

Compression:

Stored size: 964 Bytes

Contents

require 'spec_helper'

describe Sift3Distance do
  class DummySift3Distance
  end

  before(:each) do
    @sift_3_distance = DummySift3Distance.new
    @sift_3_distance.extend(Sift3Distance)
  end

  describe "#sift_3_distance" do
    it "returns the different of two strings" do
      s1 = "example"
      s2 = "eample"
      expect(@sift_3_distance.sift_3_distance s1, s2).to eq 1
    end
    it "returns zero when both arguments is nil or empty" do
      s1 = nil
      s2 = ""
      expect(@sift_3_distance.sift_3_distance s1, s2).to eq 0
    end
    it "returns the length of the first string if the second sring is nil or empty" do
      s1 = "example"
      s2 = nil
      expect(@sift_3_distance.sift_3_distance s1, s2).to eq s1.length
    end
    it "returns the length of the second string if the first string is nil or empty" do
      s1 = nil
      s2 = "example"
      expect(@sift_3_distance.sift_3_distance s1, s2).to eq s2.length
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dnsaur-0.1.0 spec/lib/dnsaur/sift_3_distance_spec.rb