Sha256: ec75c056583801b1fba5b10645616cb19fccaf1ed3eae69a4c8b0a9d1a291a9c

Contents?: true

Size: 1.04 KB

Versions: 2

Compression:

Stored size: 1.04 KB

Contents

require 'spec_helper'

describe Gematria::English do
  it "is instantiated with text and provides access to that text" do
    gematria = Gematria::English.new('mytext')
    expect(gematria.text).to eq 'mytext'
  end

  describe "#mapped" do
    it "returns an array of values for each character in text" do
      gematria = Gematria::English.new('abc')
      expect(gematria.mapped).to eq [1,2,3]
    end
  end

  describe "#converted" do
    it "returns the sum of the letter values" do
      gematria = Gematria::English.new('abc')
      expect(gematria.converted).to eq 6
    end
  end

  describe "#reduced" do
    context "when converted value is a single digit" do
      it "returns a single digit" do
        gematria = Gematria::English.new('abc')
        expect(gematria.reduced).to eq 6
      end
    end
    context "when converted value is more than one digit" do
      it "returns a single digit" do
        gematria = Gematria::English.new('abcdefghijklmnopqrstuvwxyz')
        expect(gematria.reduced).to eq 9 # 4095 -> 18 -> 9
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
gematria-0.0.2 spec/gematria/english_spec.rb
gematria-0.0.1 spec/gematria/english_spec.rb