Skip to content

Commit

Permalink
Simplify testing feed_meta tag
Browse files Browse the repository at this point in the history
  • Loading branch information
pathawks committed Mar 21, 2016
1 parent 02349f6 commit 6ecea4b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 12 deletions.
4 changes: 0 additions & 4 deletions spec/fixtures/index.html

This file was deleted.

15 changes: 7 additions & 8 deletions spec/jekyll-feed_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
end
let(:site) { Jekyll::Site.new(config) }
let(:contents) { File.read(dest_dir("feed.xml")) }
let(:context) { make_context(site: site) }
let(:feed_meta) { Liquid::Template.parse("{% feed_meta %}").render!(context, {}) }
before(:each) do
site.process
end
Expand Down Expand Up @@ -196,17 +198,15 @@
end

it "renders the feed meta" do
index = File.read(dest_dir("index.html"))
expected = '<link type="application/atom+xml" rel="alternate" href="http://example.org/bass/feed.xml" title="My awesome site" />'
expect(index).to include(expected)
expected = 'href="http://example.org/bass/feed.xml"'
expect(feed_meta).to include(expected)
end
end

context "feed meta" do
it "renders the feed meta" do
index = File.read(dest_dir("index.html"))
expected = '<link type="application/atom+xml" rel="alternate" href="http://example.org/feed.xml" title="My awesome site" />'
expect(index).to include(expected)
expect(feed_meta).to include(expected)
end
end

Expand All @@ -224,9 +224,8 @@
end

it "renders the feed meta with custom feed path" do
index = File.read(dest_dir("index.html"))
expected = '<link type="application/atom+xml" rel="alternate" href="http://example.org/atom.xml" title="My awesome site" />'
expect(index).to include(expected)
expected = 'href="http://example.org/atom.xml"'
expect(feed_meta).to include(expected)
end
end
end
4 changes: 4 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,8 @@ def source_dir(*files)
def dest_dir(*files)
File.join(DEST_DIR, *files)
end

def make_context(registers = {})
Liquid::Context.new({}, {}, { site: site }.merge(registers))
end
end

0 comments on commit 6ecea4b

Please sign in to comment.