Sha256: ac065c1cdbc8fed2a997658b870c0c695346ef39ecd602a09e804db09f8e97cd

Contents?: true

Size: 785 Bytes

Versions: 4

Compression:

Stored size: 785 Bytes

Contents

# encoding: utf-8
require "spec_helper"

module Corrector
  describe Prefix do

    it "is a kind of Corrector::Base" do
      expect(subject).to be_kind_of Corrector::Base
    end

    describe "#valid?" do

      subject { build :prefix }
      before  { expect(subject).to be_valid }

      it "fails when #from has spaces" do
        subject.from = "РАЗ ДВА"
        expect(subject).not_to be_valid
      end
    end

    describe ".scan" do

      before { create :prefix, from: "КИЛО", to: "К" }

      it "separates and changes a prefix" do
        expect(Prefix.scan "КИЛОМЕТР").to eq(%w(К ^ МЕТР))
      end

      it "doesn't change middle of word" do
        expect(Prefix.scan "ПОЛКИЛО").to eq(%w(ПОЛКИЛО))
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
corrector-0.1.0 spec/models/corrector/prefix_spec.rb
corrector-0.0.3 spec/models/corrector/prefix_spec.rb
corrector-0.0.2 spec/models/corrector/prefix_spec.rb
corrector-0.0.1 spec/models/corrector/prefix_spec.rb