Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify testing feed_meta tag #101

Merged
merged 1 commit into from
Mar 21, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 eql(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