Sha256: 3c48b62c9d5d2c897002cf75d6440eb8873abd477c01898d175d446627bcdb0d

Contents?: true

Size: 1.33 KB

Versions: 1

Compression:

Stored size: 1.33 KB

Contents

# -*- coding: UTF-8 -*-

require 'spec_helper'
require 'middleman-blog-similar/algorithm/word_frequency/mecab'

describe 'Middleman::Blog::Similar::Algorithm::WordFrequency::Mecab' do
  let(:app)     {
    middleman_app('test-app') {
      activate :similar, :algorithm => :'word_frequency/mecab'
    }
  }
  let(:article) { app.sitemap.find_resource_by_destination_path '/2014/05/11/article3.html' }
  let(:algorithm)  { article.similarity_algorithm }
  describe(:app) {
    describe(:similarity_algorithm) {
      subject { app.similarity_algorithm }
      it { should be ::Middleman::Blog::Similar::Algorithm::WordFrequency::Mecab  }
    }
  }
  describe(:similarity_algorithm) {
    subject { algorithm }
    it { should be_a_kind_of ::Middleman::Blog::Similar::Algorithm::WordFrequency::Mecab }
  }
  describe(:tags) {
    describe(:output) {
      if %x{which mecab}
        subject { algorithm.tags }
        it { should eq ["fox", "国家", "隙", "教師", "悪口", "尻", "坊ちゃん", "時分", "向", "叫び", "人間", "ネルソン", "この世", "西洋", "expect", "articl"] }
      else
        pending "mecab is not installed."
      end
    }
  }
  describe(:article) {
    describe(:similarity_algorithm) {
      subject { algorithm }
      it { should be_a_kind_of ::Middleman::Blog::Similar::Algorithm::WordFrequency::Mecab }
    }
  }

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
middleman-blog-similar-1.1.1 spec/middleman-blog-similar/algorithm/word_frequency/mecab_spec.rb