Merge pull request #5114 from XhmikosR/typo-fixes

Merge pull request 5114
This commit is contained in:
jekyllbot 2016-07-18 21:46:30 -07:00 committed by GitHub
commit 0963f85871
14 changed files with 49 additions and 49 deletions

View File

@ -28,7 +28,7 @@ class TestCollections < JekyllUnitTest
assert_equal @collection.label, "methods" assert_equal @collection.label, "methods"
end end
should "have default url template" do should "have default URL template" do
assert_equal @collection.url_template, "/:collection/:path:output_ext" assert_equal @collection.url_template, "/:collection/:path:output_ext"
end end
@ -99,7 +99,7 @@ class TestCollections < JekyllUnitTest
@collection = @site.collections["methods"] @collection = @site.collections["methods"]
end end
should "have custom url template" do should "have custom URL template" do
assert_equal @collection.url_template, "/awesome/:path/" assert_equal @collection.url_template, "/awesome/:path/"
end end
end end

View File

@ -99,7 +99,7 @@ class TestCommandsServe < JekyllUnitTest
end end
end end
context "enabling ssl" do context "enabling SSL" do
should "raise if enabling without key or cert" do should "raise if enabling without key or cert" do
assert_raises RuntimeError do assert_raises RuntimeError do
custom_opts({ custom_opts({

View File

@ -2,7 +2,7 @@ require "helper"
require "ostruct" require "ostruct"
class TestConvertible < JekyllUnitTest class TestConvertible < JekyllUnitTest
context "yaml front-matter" do context "YAML front matter" do
setup do setup do
@convertible = OpenStruct.new( @convertible = OpenStruct.new(
"site" => Site.new(Jekyll.configuration( "site" => Site.new(Jekyll.configuration(
@ -13,17 +13,17 @@ class TestConvertible < JekyllUnitTest
@base = File.expand_path("../fixtures", __FILE__) @base = File.expand_path("../fixtures", __FILE__)
end end
should "parse the front-matter correctly" do should "parse the front matter correctly" do
ret = @convertible.read_yaml(@base, "front_matter.erb") ret = @convertible.read_yaml(@base, "front_matter.erb")
assert_equal({ "test" => "good" }, ret) assert_equal({ "test" => "good" }, ret)
end end
should "not parse if the front-matter is not at the start of the file" do should "not parse if the front matter is not at the start of the file" do
ret = @convertible.read_yaml(@base, "broken_front_matter1.erb") ret = @convertible.read_yaml(@base, "broken_front_matter1.erb")
assert_equal({}, ret) assert_equal({}, ret)
end end
should "not parse if there is syntax error in front-matter" do should "not parse if there is syntax error in front matter" do
name = "broken_front_matter2.erb" name = "broken_front_matter2.erb"
out = capture_stderr do out = capture_stderr do
ret = @convertible.read_yaml(@base, name) ret = @convertible.read_yaml(@base, name)
@ -33,7 +33,7 @@ class TestConvertible < JekyllUnitTest
assert_match(%r!#{File.join(@base, name)}!, out) assert_match(%r!#{File.join(@base, name)}!, out)
end end
should "not allow ruby objects in yaml" do should "not allow ruby objects in YAML" do
out = capture_stderr do out = capture_stderr do
@convertible.read_yaml(@base, "exploit_front_matter.erb") @convertible.read_yaml(@base, "exploit_front_matter.erb")
end end
@ -50,14 +50,14 @@ class TestConvertible < JekyllUnitTest
assert_match(%r!#{File.join(@base, name)}!, out) assert_match(%r!#{File.join(@base, name)}!, out)
end end
should "parse the front-matter but show an error if permalink is empty" do should "parse the front matter but show an error if permalink is empty" do
name = "empty_permalink.erb" name = "empty_permalink.erb"
assert_raises(Errors::InvalidPermalinkError) do assert_raises(Errors::InvalidPermalinkError) do
@convertible.read_yaml(@base, name) @convertible.read_yaml(@base, name)
end end
end end
should "parse the front-matter correctly whitout permalink" do should "parse the front matter correctly without permalink" do
out = capture_stderr do out = capture_stderr do
@convertible.read_yaml(@base, "front_matter.erb") @convertible.read_yaml(@base, "front_matter.erb")
end end

View File

@ -2,7 +2,7 @@ require "helper"
require "jekyll/commands/doctor" require "jekyll/commands/doctor"
class TestDoctorCommand < JekyllUnitTest class TestDoctorCommand < JekyllUnitTest
context "urls only differ by case" do context "URLs only differ by case" do
setup do setup do
clear_dest clear_dest
end end

View File

@ -36,7 +36,7 @@ class TestDocument < JekyllUnitTest
assert_equal "configuration", @document.basename_without_ext assert_equal "configuration", @document.basename_without_ext
end end
should "know whether its a yaml file" do should "know whether it's a YAML file" do
assert_equal false, @document.yaml_file? assert_equal false, @document.yaml_file?
end end
@ -110,7 +110,7 @@ class TestDocument < JekyllUnitTest
end end
end end
context "a document as part of a collection with frontmatter defaults" do context "a document as part of a collection with front matter defaults" do
setup do setup do
@site = fixture_site({ @site = fixture_site({
"collections" => ["slides"], "collections" => ["slides"],
@ -127,14 +127,14 @@ class TestDocument < JekyllUnitTest
@document = @site.collections["slides"].docs.select { |d| d.is_a?(Document) }.first @document = @site.collections["slides"].docs.select { |d| d.is_a?(Document) }.first
end end
should "know the frontmatter defaults" do should "know the front matter defaults" do
assert_equal "Example slide", @document.data["title"] assert_equal "Example slide", @document.data["title"]
assert_equal "slide", @document.data["layout"] assert_equal "slide", @document.data["layout"]
assert_equal({ "key"=>"myval" }, @document.data["nested"]) assert_equal({ "key"=>"myval" }, @document.data["nested"])
end end
end end
context "a document as part of a collection with overriden default values" do context "a document as part of a collection with overridden default values" do
setup do setup do
@site = fixture_site({ @site = fixture_site({
"collections" => ["slides"], "collections" => ["slides"],
@ -152,7 +152,7 @@ class TestDocument < JekyllUnitTest
@document = @site.collections["slides"].docs[1] @document = @site.collections["slides"].docs[1]
end end
should "override default values in the document frontmatter" do should "override default values in the document front matter" do
assert_equal "Override title", @document.data["title"] assert_equal "Override title", @document.data["title"]
assert_equal "slide", @document.data["layout"] assert_equal "slide", @document.data["layout"]
assert_equal( assert_equal(
@ -179,7 +179,7 @@ class TestDocument < JekyllUnitTest
@document = @site.collections["slides"].docs.first @document = @site.collections["slides"].docs.first
end end
should "know the frontmatter defaults" do should "know the front matter defaults" do
assert_equal "Example slide", @document.data["title"] assert_equal "Example slide", @document.data["title"]
assert_equal "slide", @document.data["layout"] assert_equal "slide", @document.data["layout"]
assert_equal({ "key"=>"value123" }, @document.data["nested"]) assert_equal({ "key"=>"value123" }, @document.data["nested"])
@ -203,7 +203,7 @@ class TestDocument < JekyllUnitTest
@document = @site.collections["slides"].docs.first @document = @site.collections["slides"].docs.first
end end
should "not know the specified frontmatter defaults" do should "not know the specified front matter defaults" do
assert_equal "Example slide", @document.data["title"] assert_equal "Example slide", @document.data["title"]
assert_equal "slide", @document.data["layout"] assert_equal "slide", @document.data["layout"]
assert_equal nil, @document.data["nested"] assert_equal nil, @document.data["nested"]

View File

@ -77,7 +77,7 @@ class TestExcerpt < JekyllUnitTest
end end
context "#to_liquid" do context "#to_liquid" do
should "contain the proper page data to mimick the post liquid" do should "contain the proper page data to mimic the post liquid" do
assert_equal "Post Excerpt with Layout", @excerpt.to_liquid["title"] assert_equal "Post Excerpt with Layout", @excerpt.to_liquid["title"]
url = "/bar/baz/z_category/mixedcase/2013/07/22/post-excerpt-with-layout.html" url = "/bar/baz/z_category/mixedcase/2013/07/22/post-excerpt-with-layout.html"
assert_equal url, @excerpt.to_liquid["url"] assert_equal url, @excerpt.to_liquid["url"]

View File

@ -151,7 +151,7 @@ class TestFilters < JekyllUnitTest
assert_equal "a b", @filter.normalize_whitespace("a \t \n\nb") assert_equal "a b", @filter.normalize_whitespace("a \t \n\nb")
end end
should "strip whitespace from begining and end of string" do should "strip whitespace from beginning and end of string" do
assert_equal "a", @filter.normalize_whitespace("a ") assert_equal "a", @filter.normalize_whitespace("a ")
assert_equal "a", @filter.normalize_whitespace(" a") assert_equal "a", @filter.normalize_whitespace(" a")
assert_equal "a", @filter.normalize_whitespace(" a ") assert_equal "a", @filter.normalize_whitespace(" a ")

View File

@ -28,7 +28,7 @@ class TestPage < JekyllUnitTest
end end
context "processing pages" do context "processing pages" do
should "create url based on filename" do should "create URL based on filename" do
@page = setup_page("contacts.html") @page = setup_page("contacts.html")
assert_equal "/contacts.html", @page.url assert_equal "/contacts.html", @page.url
end end
@ -38,18 +38,18 @@ class TestPage < JekyllUnitTest
assert_equal false, @page.published? assert_equal false, @page.published?
end end
should "create url with non-alphabetic characters" do should "create URL with non-alphabetic characters" do
@page = setup_page("+", "%# +.md") @page = setup_page("+", "%# +.md")
assert_equal "/+/%25%23%20+.html", @page.url assert_equal "/+/%25%23%20+.html", @page.url
end end
context "in a directory hierarchy" do context "in a directory hierarchy" do
should "create url based on filename" do should "create URL based on filename" do
@page = setup_page("/contacts", "bar.html") @page = setup_page("/contacts", "bar.html")
assert_equal "/contacts/bar.html", @page.url assert_equal "/contacts/bar.html", @page.url
end end
should "create index url based on filename" do should "create index URL based on filename" do
@page = setup_page("/contacts", "index.html") @page = setup_page("/contacts", "index.html")
assert_equal "/contacts/", @page.url assert_equal "/contacts/", @page.url
end end
@ -105,7 +105,7 @@ class TestPage < JekyllUnitTest
@site.permalink_style = :pretty @site.permalink_style = :pretty
end end
should "return dir, url, and destination correctly" do should "return dir, URL, and destination correctly" do
@page = setup_page("contacts.html") @page = setup_page("contacts.html")
@dest_file = dest_dir("contacts/index.html") @dest_file = dest_dir("contacts/index.html")
@ -125,7 +125,7 @@ class TestPage < JekyllUnitTest
assert_equal "/contacts/bar/", @page.url assert_equal "/contacts/bar/", @page.url
end end
should "create index url based on filename" do should "create index URL based on filename" do
@page = setup_page("/contacts", "index.html") @page = setup_page("/contacts", "index.html")
assert_equal "/contacts/", @page.url assert_equal "/contacts/", @page.url
end end
@ -166,7 +166,7 @@ class TestPage < JekyllUnitTest
@site.permalink_style = "/:title/" @site.permalink_style = "/:title/"
end end
should "return url and destination correctly" do should "return URL and destination correctly" do
@page = setup_page("contacts.html") @page = setup_page("contacts.html")
@dest_file = dest_dir("contacts/index.html") @dest_file = dest_dir("contacts/index.html")
assert_equal "/contacts/", @page.url assert_equal "/contacts/", @page.url
@ -179,7 +179,7 @@ class TestPage < JekyllUnitTest
@site.permalink_style = "/:title:output_ext" @site.permalink_style = "/:title:output_ext"
end end
should "return url and destination correctly" do should "return URL and destination correctly" do
@page = setup_page("contacts.html") @page = setup_page("contacts.html")
@dest_file = dest_dir("contacts.html") @dest_file = dest_dir("contacts.html")
assert_equal "/contacts.html", @page.url assert_equal "/contacts.html", @page.url
@ -192,7 +192,7 @@ class TestPage < JekyllUnitTest
@site.permalink_style = "/:title" @site.permalink_style = "/:title"
end end
should "return url and destination correctly" do should "return URL and destination correctly" do
@page = setup_page("contacts.html") @page = setup_page("contacts.html")
@dest_file = dest_dir("contacts.html") @dest_file = dest_dir("contacts.html")
assert_equal "/contacts", @page.url assert_equal "/contacts", @page.url
@ -209,7 +209,7 @@ class TestPage < JekyllUnitTest
end end
end end
should "respect permalink in yaml front matter" do should "respect permalink in YAML front matter" do
file = "about.html" file = "about.html"
@page = setup_page(file) @page = setup_page(file)

View File

@ -166,7 +166,7 @@ class TestRegenerator < JekyllUnitTest
assert_equal File.mtime(@path), @regenerator.metadata[@path]["mtime"] assert_equal File.mtime(@path), @regenerator.metadata[@path]["mtime"]
end end
should "read legacy yaml metadata" do should "read legacy YAML metadata" do
metadata_file = source_dir(".jekyll-metadata") metadata_file = source_dir(".jekyll-metadata")
@regenerator = Regenerator.new(@site) @regenerator = Regenerator.new(@site)
@ -305,7 +305,7 @@ class TestRegenerator < JekyllUnitTest
end end
end end
context "when incremental regen is disabled" do context "when incremental regeneration is disabled" do
setup do setup do
FileUtils.rm_rf(source_dir(".jekyll-metadata")) FileUtils.rm_rf(source_dir(".jekyll-metadata"))
@site = Site.new(Jekyll.configuration({ @site = Site.new(Jekyll.configuration({

View File

@ -18,7 +18,7 @@ class TestRelatedPosts < JekyllUnitTest
end end
end end
context "building related posts with lsi" do context "building related posts with LSI" do
setup do setup do
if jruby? if jruby?
skip( skip(
@ -53,7 +53,7 @@ class TestRelatedPosts < JekyllUnitTest
Jekyll::RelatedPosts.new(post).build Jekyll::RelatedPosts.new(post).build
end end
should "use lsi for the related posts" do should "use LSI for the related posts" do
allow_any_instance_of(::ClassifierReborn::LSI).to \ allow_any_instance_of(::ClassifierReborn::LSI).to \
receive(:find_related).and_return(@site.posts[-1..-9]) receive(:find_related).and_return(@site.posts[-1..-9])
allow_any_instance_of(::ClassifierReborn::LSI).to receive(:build_index) allow_any_instance_of(::ClassifierReborn::LSI).to receive(:build_index)

View File

@ -210,12 +210,12 @@ class TestSite < JekyllUnitTest
assert_equal posts.size - @num_invalid_posts, @site.posts.size assert_equal posts.size - @num_invalid_posts, @site.posts.size
end end
should "read pages with yaml front matter" do should "read pages with YAML front matter" do
abs_path = File.expand_path("about.html", @site.source) abs_path = File.expand_path("about.html", @site.source)
assert_equal true, Utils.has_yaml_header?(abs_path) assert_equal true, Utils.has_yaml_header?(abs_path)
end end
should "enforce a strict 3-dash limit on the start of the YAML front-matter" do should "enforce a strict 3-dash limit on the start of the YAML front matter" do
abs_path = File.expand_path("pgp.key", @site.source) abs_path = File.expand_path("pgp.key", @site.source)
assert_equal false, Utils.has_yaml_header?(abs_path) assert_equal false, Utils.has_yaml_header?(abs_path)
end end
@ -330,7 +330,7 @@ class TestSite < JekyllUnitTest
s = Site.new(site_configuration("markdown" => custom_processor)) s = Site.new(site_configuration("markdown" => custom_processor))
s.process s.process
# Do some cleanup, we don't like straggling stuff's. # Do some cleanup, we don't like straggling stuff.
Jekyll::Converters::Markdown.send(:remove_const, :CustomMarkdown) Jekyll::Converters::Markdown.send(:remove_const, :CustomMarkdown)
end end
@ -356,7 +356,7 @@ class TestSite < JekyllUnitTest
s.process s.process
end end
# Do some cleanup, we don't like straggling stuff's. # Do some cleanup, we don't like straggling stuff.
Jekyll::Converters::Markdown.send(:remove_const, :Custom) Jekyll::Converters::Markdown.send(:remove_const, :Custom)
end end
end end
@ -544,7 +544,7 @@ class TestSite < JekyllUnitTest
assert_equal mtime3, mtime4 # no modifications, so remain the same assert_equal mtime3, mtime4 # no modifications, so remain the same
end end
should "regnerate files that have had their destination deleted" do should "regenerate files that have had their destination deleted" do
contacts_html = @site.pages.find { |p| p.name == "contacts.html" } contacts_html = @site.pages.find { |p| p.name == "contacts.html" }
@site.process @site.process

View File

@ -118,7 +118,7 @@ class TestStaticFile < JekyllUnitTest
assert @static_file.modified? assert @static_file.modified?
end end
should "known if the source path is modified, when its not" do should "known if the source path is modified, when it's not" do
@static_file.write(dest_dir) @static_file.write(dest_dir)
sleep 1 # wait, else the times are still the same sleep 1 # wait, else the times are still the same
assert !@static_file.modified? assert !@static_file.modified?
@ -128,7 +128,7 @@ class TestStaticFile < JekyllUnitTest
assert @static_file.write?, "always true, with current implementation" assert @static_file.write?, "always true, with current implementation"
end end
should "be able to write itself to the desitination directory" do should "be able to write itself to the destination directory" do
assert @static_file.write(dest_dir) assert @static_file.write(dest_dir)
end end

View File

@ -547,7 +547,7 @@ CONTENT
refute_match(%r!markdown\-html\-error!, @result) refute_match(%r!markdown\-html\-error!, @result)
end end
should "have the url to the \"complex\" post from 2008-11-21" do should "have the URL to the \"complex\" post from 2008-11-21" do
assert_match %r!/2008/11/21/complex/!, @result assert_match %r!/2008/11/21/complex/!, @result
end end
end end
@ -576,12 +576,12 @@ CONTENT
refute_match(%r!markdown\-html\-error!, @result) refute_match(%r!markdown\-html\-error!, @result)
end end
should "have the url to the \"complex\" post from 2008-11-21" do should "have the URL to the \"complex\" post from 2008-11-21" do
assert_match %r!1\s/2008/11/21/complex/!, @result assert_match %r!1\s/2008/11/21/complex/!, @result
assert_match %r!2\s/2008/11/21/complex/!, @result assert_match %r!2\s/2008/11/21/complex/!, @result
end end
should "have the url to the \"nested\" post from 2008-11-21" do should "have the URL to the \"nested\" post from 2008-11-21" do
assert_match %r!3\s/2008/11/21/nested/!, @result assert_match %r!3\s/2008/11/21/nested/!, @result
assert_match %r!4\s/2008/11/21/nested/!, @result assert_match %r!4\s/2008/11/21/nested/!, @result
end end
@ -648,7 +648,7 @@ CONTENT
refute_match(%r!markdown\-html\-error!, @result) refute_match(%r!markdown\-html\-error!, @result)
end end
should "have the url to the \"yaml_with_dots\" item" do should "have the URL to the \"yaml_with_dots\" item" do
assert_match(%r!/methods/yaml_with_dots\.html!, @result) assert_match(%r!/methods/yaml_with_dots\.html!, @result)
end end
end end
@ -675,11 +675,11 @@ CONTENT
refute_match(%r!markdown\-html\-error!, @result) refute_match(%r!markdown\-html\-error!, @result)
end end
should "have the url to the \"sanitized_path\" item" do should "have the URL to the \"sanitized_path\" item" do
assert_match %r!1\s/methods/sanitized_path\.html!, @result assert_match %r!1\s/methods/sanitized_path\.html!, @result
end end
should "have the url to the \"site/generate\" item" do should "have the URL to the \"site/generate\" item" do
assert_match %r!2\s/methods/site/generate\.html!, @result assert_match %r!2\s/methods/site/generate\.html!, @result
end end
end end

View File

@ -356,12 +356,12 @@ class TestUtils < JekyllUnitTest
end end
context "The \`Utils.has_yaml_header?\` method" do context "The \`Utils.has_yaml_header?\` method" do
should "accept files with yaml front matter" do should "accept files with YAML front matter" do
file = source_dir("_posts", "2008-10-18-foo-bar.markdown") file = source_dir("_posts", "2008-10-18-foo-bar.markdown")
assert_equal "---\n", File.open(file, "rb") { |f| f.read(4) } assert_equal "---\n", File.open(file, "rb") { |f| f.read(4) }
assert Utils.has_yaml_header?(file) assert Utils.has_yaml_header?(file)
end end
should "accept files with extraneous spaces after yaml front matter" do should "accept files with extraneous spaces after YAML front matter" do
file = source_dir("_posts", "2015-12-27-extra-spaces.markdown") file = source_dir("_posts", "2015-12-27-extra-spaces.markdown")
assert_equal "--- \n", File.open(file, "rb") { |f| f.read(6) } assert_equal "--- \n", File.open(file, "rb") { |f| f.read(6) }
assert Utils.has_yaml_header?(file) assert Utils.has_yaml_header?(file)