spec/jekyll-sitemap_spec.rb in jekyll-sitemap-0.10.0 vs spec/jekyll-sitemap_spec.rb in jekyll-sitemap-0.11.0
- old
+ new
@@ -91,10 +91,14 @@
it "does include assets or any static files with .xhtml and .htm extensions" do
expect(contents).to match /\/some-subfolder\/xhtml\.xhtml/
expect(contents).to match /\/some-subfolder\/htm\.htm/
end
+ it "does include assets or any static files with .pdf extension" do
+ expect(contents).to match %r!/static_files/test.pdf!
+ end
+
it "does not include posts that have set 'sitemap: false'" do
expect(contents).not_to match /\/exclude-this-post\.html<\/loc>/
end
it "does not include pages that have set 'sitemap: false'" do
@@ -104,11 +108,11 @@
it "correctly formats timestamps of static files" do
expect(contents).to match /\/this-is-a-subfile\.html<\/loc>\s+<lastmod>\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(-|\+)\d{2}:\d{2}<\/lastmod>/
end
it "includes the correct number of items" do
- expect(contents.scan(/(?=<url>)/).count).to eql 15
+ expect(contents.scan(/(?=<url>)/).count).to eql 19
end
context "with a baseurl" do
let(:config) do
Jekyll.configuration(Jekyll::Utils.deep_merge_hashes(overrides, {"baseurl" => "/bass"}))
@@ -132,21 +136,24 @@
expect(contents).to match /<loc>http:\/\/example\.org\/bass\/2014\/03\/02\/march-the-second\.html<\/loc>/
expect(contents).to match /<loc>http:\/\/example\.org\/bass\/2013\/12\/12\/dec-the-second\.html<\/loc>/
end
end
- context "with site url that needs URI encoding" do
+ context "with urls that needs URI encoding" do
let(:config) do
- Jekyll.configuration(Jekyll::Utils.deep_merge_hashes(overrides, {"url" => "http://has ümlaut.org"}))
+ Jekyll.configuration(Jekyll::Utils.deep_merge_hashes(overrides, {"url" => "http://ümlaut.example.org"}))
end
it "performs URI encoding of site url" do
- expect(contents).to match /<loc>http:\/\/has%20%C3%BCmlaut\.org\/<\/loc>/
- expect(contents).to match /<loc>http:\/\/has%20%C3%BCmlaut\.org\/some-subfolder\/this-is-a-subpage\.html<\/loc>/
- expect(contents).to match /<loc>http:\/\/has%20%C3%BCmlaut\.org\/2014\/03\/04\/march-the-fourth\.html<\/loc>/
+ expect(contents).to match %r!<loc>http://xn--mlaut-jva.example.org/</loc>!
+ expect(contents).to match %r!<loc>http://xn--mlaut-jva.example.org/some-subfolder/this-is-a-subpage.html</loc>!
+ expect(contents).to match %r!<loc>http://xn--mlaut-jva.example.org/2014/03/04/march-the-fourth.html</loc>!
+ expect(contents).to match %r!<loc>http://xn--mlaut-jva.example.org/2016/04/01/%E9%94%99%E8%AF%AF.html</loc>!
+ expect(contents).to match %r!<loc>http://xn--mlaut-jva.example.org/2016/04/02/%E9%94%99%E8%AF%AF.html</loc>!
+ expect(contents).to match %r!<loc>http://xn--mlaut-jva.example.org/2016/04/03/%E9%94%99%E8%AF%AF.html</loc>!
end
- it "does not double-escape site url" do
+ it "does not double-escape urls" do
expect(contents).to_not match /%25/
end
end
end