spec/jekyll-sitemap_spec.rb in jekyll-sitemap-0.12.0 vs spec/jekyll-sitemap_spec.rb in jekyll-sitemap-0.13.0
- old
+ new
@@ -134,10 +134,15 @@
it "correctly adds the baseurl to the posts" do
expect(contents).to match /<loc>http:\/\/example\.org\/bass\/2014\/03\/04\/march-the-fourth\.html<\/loc>/
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
+
+ it "adds baseurl to robots.txt" do
+ content = File.read(dest_dir("robots.txt"))
+ expect(content).to match("Sitemap: http://example.org/bass/sitemap.xml")
+ end
end
context "with urls that needs URI encoding" do
let(:config) do
Jekyll.configuration(Jekyll::Utils.deep_merge_hashes(overrides, {"url" => "http://ümlaut.example.org"}))
@@ -152,8 +157,24 @@
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 urls" do
expect(contents).to_not match /%25/
+ end
+
+ context "readme" do
+ let(:contents) { File.read(dest_dir("robots.txt")) }
+
+ it "has no layout" do
+ expect(contents).not_to match(/\ATHIS IS MY LAYOUT/)
+ end
+
+ it "creates a sitemap.xml file" do
+ expect(File.exist?(dest_dir("robots.txt"))).to be_truthy
+ end
+
+ it "renders liquid" do
+ expect(contents).to match("Sitemap: http://xn--mlaut-jva.example.org/sitemap.xml")
+ end
end
end
end