Sha256: a50902c2a725ac3dff61f1ec0986269c07f449cbda96d8eb45453a301c012bd9

Contents?: true

Size: 1.38 KB

Versions: 2

Compression:

Stored size: 1.38 KB

Contents

# coding: utf-8
require "spec_helper"

describe Tataki::Converter::Combine do
  let(:skk_converter) { Tataki::Converter::SkkJisyo.new }
  let(:roman_converter) { Tataki::Converter::Roman.new }
  let(:alphabet_converter) { Tataki::Converter::Alphabet.new }

  describe ".to_kana" do
    shared_examples "converts_kana" do |sentence, kana|
      it "converts #{sentence.inspect} to #{kana.inspect}" do
        expect(converter.to_kana(sentence)).to eq(kana)
      end
    end

    context "when roman + alphabet" do
      let(:converter) do
        Tataki::Converter::Combine.new(roman_converter, alphabet_converter)
      end

      include_examples "converts_kana", "robottotaisennf", "ろぼっとたいせんえふ"
    end

    context "when skk-jisyo + alphabet" do
      let(:converter) do
        Tataki::Converter::Combine.new(skk_converter, alphabet_converter)
      end

      include_examples "converts_kana", "X線の研究をしています", "えっくすせんのけんきゅうをしています"
      include_examples "converts_kana", "X線研究者", "えっくすせんけんきゅうしゃ"
      include_examples "converts_kana", "電気通信大学X線研究", "でんきつうしんだいがくえっくすせんけんきゅう"
      include_examples "converts_kana", "DNAは螺旋状の構造らしい", "でぃーえぬえーはらせんじょうのこうぞうらしい"
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
tataki-0.0.3 spec/tataki/converters/combine_spec.rb
tataki-0.0.2 spec/tataki/converters/combine_spec.rb