Merge pull request #160 from renshuki/metaname-author-unit-tests

Add specs for author metadata
This commit is contained in:
Ben Balter 2017-02-21 11:00:55 -05:00 committed by GitHub
commit a814dc6f0f
1 changed files with 49 additions and 0 deletions

49
spec/jekyll_seo_tag_spec.rb Normal file → Executable file
View File

@ -366,6 +366,55 @@ EOS
end
end
context "author" do
let(:site) { make_site("author" => "Site Author") }
context "with site.author" do
it "outputs site author metadata" do
expected = %r!<meta name="author" content="Site Author" />!
expect(output).to match(expected)
end
end
context "with page.author" do
let(:page) { make_page("author" => "Page Author") }
it "outputs page author metadata" do
expected = %r!<meta name="author" content="Page Author" />!
expect(output).to match(expected)
end
end
context "without page.author" do
let(:page) { make_page("author" => "") }
it "outputs site author metadata" do
expected = %r!<meta name="author" content="Site Author" />!
expect(output).to match(expected)
end
end
context "with site.data.authors" do
let(:author_data) { { "renshuki" => { "name" => "Site Data Author" } } }
let(:data) { { "authors" => author_data } }
context "with the author in site.data.authors" do
let(:site) { make_site("data" => data, "author" => "renshuki") }
it "outputs the author metadata" do
expected = %r!<meta name="author" content="Site Data Author" />!
expect(output).to match(expected)
end
end
context "without the author in site.data.authors" do
it "outputs site author metadata" do
expected = %r!<meta name="author" content="Site Author" />!
expect(output).to match(expected)
end
end
end
end
context "with site.social" do
let(:links) { ["http://foo.invalid", "http://bar.invalid"] }
let(:social_namespace) { { "name" => "Ben", "links" => links } }