From e5f26b5a36206c5fbdf674bc76cede7be37bccfa Mon Sep 17 00:00:00 2001 From: Jordon Bedwell Date: Thu, 29 Oct 2015 15:18:19 -0500 Subject: [PATCH] Fix test warnings when doing rake {test,spec} or script/test --- lib/jekyll/document.rb | 9 ++++----- test/test_document.rb | 2 +- test/test_site.rb | 2 +- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/lib/jekyll/document.rb b/lib/jekyll/document.rb index 00a0ca7a..763559bf 100644 --- a/lib/jekyll/document.rb +++ b/lib/jekyll/document.rb @@ -366,11 +366,10 @@ module Jekyll # # Returns -1, 0, +1 or nil depending on whether this doc's path is less than, # equal or greater than the other doc's path. See String#<=> for more details. - def <=>(anotherDocument) - cmp = data['date'] <=> anotherDocument.data['date'] - if 0 == cmp - cmp = path <=> anotherDocument.path - end + def <=>(other) + return nil if !other.respond_to?(:data) + cmp = data['date'] <=> other.data['date'] + cmp = path <=> other.path if cmp == 0 cmp end diff --git a/test/test_document.rb b/test/test_document.rb index 9f337c27..a1e0c9cd 100644 --- a/test/test_document.rb +++ b/test/test_document.rb @@ -328,7 +328,7 @@ class TestDocument < JekyllUnitTest end should "be output in the correct place" do - assert_equal true, File.file?(@dest_file) + assert File.file?(@dest_file) end end diff --git a/test/test_site.rb b/test/test_site.rb index 66f1408d..bea2fcc0 100644 --- a/test/test_site.rb +++ b/test/test_site.rb @@ -465,7 +465,7 @@ class TestSite < JekyllUnitTest end should "print profile table" do - @site.liquid_renderer.should_receive(:stats_table) + expect(@site.liquid_renderer).to receive(:stats_table) @site.process end end