Skip to content

Commit

Permalink
test: escape dots
Browse files Browse the repository at this point in the history
  • Loading branch information
DirtyF committed Oct 23, 2018
1 parent a357552 commit 1b161c7
Showing 1 changed file with 29 additions and 29 deletions.
58 changes: 29 additions & 29 deletions spec/jekyll-feed_spec.rb
Expand Up @@ -43,24 +43,24 @@
end

it "puts all the posts in the feed.xml file" do
expect(contents).to match %r!http://example.org/updates/2014/03/04/march-the-fourth.html!
expect(contents).to match %r!http://example.org/news/2014/03/02/march-the-second.html!
expect(contents).to match %r!http://example.org/news/2013/12/12/dec-the-second.html!
expect(contents).to match %r!http://example\.org/updates/2014/03/04/march-the-fourth\.html!
expect(contents).to match %r!http://example\.org/news/2014/03/02/march-the-second\.html!
expect(contents).to match %r!http://example\.org/news/2013/12/12/dec-the-second\.html!
expect(contents).to match "http://example.org/2015/08/08/stuck-in-the-middle.html"
expect(contents).to_not match %r!http://example.org/2016/02/09/a-draft.html!
expect(contents).to_not match %r!http://example\.org/2016/02/09/a-draft\.html!
end

it "does not include assets or any static files that aren't .html" do
expect(contents).not_to match %r!http://example.org/images/hubot.png!
expect(contents).not_to match %r!http://example.org/feeds/atom.xml!
expect(contents).not_to match %r!http://example\.org/images/hubot\.png!
expect(contents).not_to match %r!http://example\.org/feeds/atom\.xml!
end

it "preserves linebreaks in preformatted text in posts" do
expect(contents).to match %r!Line 1\nLine 2\nLine 3!
end

it "supports post author name as an object" do
expect(contents).to match %r!<author>\s*<name>Ben</name>\s*<email>ben@example.com</email>\s*<uri>http://ben.balter.com</uri>\s*</author>!
expect(contents).to match %r!<author>\s*<name>Ben</name>\s*<email>ben@example\.com</email>\s*<uri>http://ben\.balter.com</uri>\s*</author>!
end

it "supports post author name as a string" do
Expand All @@ -72,7 +72,7 @@
end

it "does use author reference with data from _data/authors.yml" do
expect(contents).to match %r!<author>\s*<name>Garth</name>\s*<email>example@mail.com</email>\s*<uri>http://garthdb.com</uri>\s*</author>!
expect(contents).to match %r!<author>\s*<name>Garth</name>\s*<email>example@mail\.com</email>\s*<uri>http://garthdb\.com</uri>\s*</author>!
end

it "converts markdown posts to HTML" do
Expand All @@ -84,7 +84,7 @@
end

it "replaces newlines in posts to spaces" do
expect(contents).to match %r!<title type="html">The plugin will properly strip newlines.</title>!
expect(contents).to match %r!<title type="html">The plugin will properly strip newlines\.</title>!
end

it "renders Liquid inside posts" do
Expand Down Expand Up @@ -159,7 +159,7 @@
end

it "renders the feed meta" do
expected = %r!<link href="http://example.org/" rel="alternate" type="text/html" hreflang="#{lang}" />!
expected = %r!<link href="http://example\.org/" rel="alternate" type="text/html" hreflang="#{lang}" />!
expect(contents).to match(expected)
end
end
Expand Down Expand Up @@ -239,9 +239,9 @@
end

it "correctly adds the baseurl to the posts" do
expect(contents).to match %r!http://example.org/bass/updates/2014/03/04/march-the-fourth.html!
expect(contents).to match %r!http://example.org/bass/news/2014/03/02/march-the-second.html!
expect(contents).to match %r!http://example.org/bass/news/2013/12/12/dec-the-second.html!
expect(contents).to match %r!http://example\.org/bass/updates/2014/03/04/march-the-fourth\.html!
expect(contents).to match %r!http://example\.org/bass/news/2014/03/02/march-the-second\.html!
expect(contents).to match %r!http://example\.org/bass/news/2013/12/12/dec-the-second\.html!
end

it "renders the feed meta" do
Expand Down Expand Up @@ -344,18 +344,18 @@
let(:news_feed) { File.read(dest_dir("feed/news.xml")) }

it "outputs the primary feed" do
expect(contents).to match %r!http://example.org/updates/2014/03/04/march-the-fourth.html!
expect(contents).to match %r!http://example.org/news/2014/03/02/march-the-second.html!
expect(contents).to match %r!http://example.org/news/2013/12/12/dec-the-second.html!
expect(contents).to match %r!http://example\.org/updates/2014/03/04/march-the-fourth\.html!
expect(contents).to match %r!http://example\.org/news/2014/03/02/march-the-second\.html!
expect(contents).to match %r!http://example\.org/news/2013/12/12/dec-the-second\.html!
expect(contents).to match "http://example.org/2015/08/08/stuck-in-the-middle.html"
expect(contents).to_not match %r!http://example.org/2016/02/09/a-draft.html!
expect(contents).to_not match %r!http://example\.org/2016/02/09/a-draft\.html!
end

it "outputs the category feed" do
expect(news_feed).to match "<title type=\"html\">My awesome site | News</title>"
expect(news_feed).to match %r!http://example.org/news/2014/03/02/march-the-second.html!
expect(news_feed).to match %r!http://example.org/news/2013/12/12/dec-the-second.html!
expect(news_feed).to_not match %r!http://example.org/updates/2014/03/04/march-the-fourth.html!
expect(news_feed).to match %r!http://example\.org/news/2014/03/02/march-the-second\.html!
expect(news_feed).to match %r!http://example\.org/news/2013/12/12/dec-the-second\.html!
expect(news_feed).to_not match %r!http://example\.org/updates/2014/03/04/march-the-fourth\.html!
expect(news_feed).to_not match "http://example.org/2015/08/08/stuck-in-the-middle.html"
end
end
Expand All @@ -375,18 +375,18 @@
let(:news_feed) { File.read(dest_dir("feed/news.xml")) }

it "outputs the primary feed" do
expect(contents).to match %r!http://example.org/updates/2014/03/04/march-the-fourth.html!
expect(contents).to match %r!http://example.org/news/2014/03/02/march-the-second.html!
expect(contents).to match %r!http://example.org/news/2013/12/12/dec-the-second.html!
expect(contents).to match %r!http://example\.org/updates/2014/03/04/march-the-fourth\.html!
expect(contents).to match %r!http://example\.org/news/2014/03/02/march-the-second\.html!
expect(contents).to match %r!http://example\.org/news/2013/12/12/dec-the-second\.html!
expect(contents).to match "http://example.org/2015/08/08/stuck-in-the-middle.html"
expect(contents).to_not match %r!http://example.org/2016/02/09/a-draft.html!
expect(contents).to_not match %r!http://example\.org/2016/02/09/a-draft\.html!
end

it "outputs the category feed" do
expect(news_feed).to match "<title type=\"html\">My awesome site | News</title>"
expect(news_feed).to match %r!http://example.org/news/2014/03/02/march-the-second.html!
expect(news_feed).to match %r!http://example.org/news/2013/12/12/dec-the-second.html!
expect(news_feed).to_not match %r!http://example.org/updates/2014/03/04/march-the-fourth.html!
expect(news_feed).to match %r!http://example\.org/news/2014/03/02/march-the-second\.html!
expect(news_feed).to match %r!http://example\.org/news/2013/12/12/dec-the-second\.html!
expect(news_feed).to_not match %r!http://example\.org/updates/2014/03/04/march-the-fourth\.html!
expect(news_feed).to_not match "http://example.org/2015/08/08/stuck-in-the-middle.html"
end
end
Expand All @@ -411,7 +411,7 @@
expect(collection_feed).to match "<title type=\"html\">My awesome site | Collection</title>"
expect(collection_feed).to match "http://example.org/collection/2018-01-01-collection-doc.html"
expect(collection_feed).to match "http://example.org/collection/2018-01-02-collection-category-doc.html"
expect(collection_feed).to_not match %r!http://example.org/updates/2014/03/04/march-the-fourth.html!
expect(collection_feed).to_not match %r!http://example\.org/updates/2014/03/04/march-the-fourth\.html!
expect(collection_feed).to_not match "http://example.org/2015/08/08/stuck-in-the-middle.html"
end
end
Expand Down Expand Up @@ -439,7 +439,7 @@
expect(news_feed).to match "<title type=\"html\">My awesome site | Collection | News</title>"
expect(news_feed).to match "http://example.org/collection/2018-01-02-collection-category-doc.html"
expect(news_feed).to_not match "http://example.org/collection/2018-01-01-collection-doc.html"
expect(news_feed).to_not match %r!http://example.org/updates/2014/03/04/march-the-fourth.html!
expect(news_feed).to_not match %r!http://example\.org/updates/2014/03/04/march-the-fourth\.html!
expect(news_feed).to_not match "http://example.org/2015/08/08/stuck-in-the-middle.html"
end
end
Expand Down

0 comments on commit 1b161c7

Please sign in to comment.