Rubocop fixes for test/test_related_posts.rb

This commit is contained in:
Brint O'Hearn 2016-05-19 20:55:44 -05:00
parent a9f110b861
commit 8f07affe2a
2 changed files with 8 additions and 6 deletions

View File

@ -78,7 +78,6 @@ AllCops:
- test/test_liquid_renderer.rb
- test/test_page.rb
- test/test_regenerator.rb
- test/test_related_posts.rb
- test/test_site.rb
- test/test_tags.rb
- test/test_utils.rb

View File

@ -1,4 +1,4 @@
require 'helper'
require "helper"
class TestRelatedPosts < JekyllUnitTest
context "building related posts without lsi" do
@ -33,26 +33,29 @@ class TestRelatedPosts < JekyllUnitTest
@site.reset
@site.read
require 'classifier-reborn'
require "classifier-reborn"
Jekyll::RelatedPosts.lsi = nil
end
should "index Jekyll::Post objects" do
@site.posts.docs = @site.posts.docs.first(1)
expect_any_instance_of(::ClassifierReborn::LSI).to receive(:add_item).with(kind_of(Jekyll::Document))
expect_any_instance_of(::ClassifierReborn::LSI).to \
receive(:add_item).with(kind_of(Jekyll::Document))
Jekyll::RelatedPosts.new(@site.posts.last).build_index
end
should "find related Jekyll::Post objects, given a Jekyll::Post object" do
post = @site.posts.last
allow_any_instance_of(::ClassifierReborn::LSI).to receive(:build_index)
expect_any_instance_of(::ClassifierReborn::LSI).to receive(:find_related).with(post, 11).and_return(@site.posts[-1..-9])
expect_any_instance_of(::ClassifierReborn::LSI).to \
receive(:find_related).with(post, 11).and_return(@site.posts[-1..-9])
Jekyll::RelatedPosts.new(post).build
end
should "use lsi for the related posts" do
allow_any_instance_of(::ClassifierReborn::LSI).to receive(:find_related).and_return(@site.posts[-1..-9])
allow_any_instance_of(::ClassifierReborn::LSI).to \
receive(:find_related).and_return(@site.posts[-1..-9])
allow_any_instance_of(::ClassifierReborn::LSI).to receive(:build_index)
assert_equal @site.posts[-1..-9], Jekyll::RelatedPosts.new(@site.posts.last).build