jekyll-seo-tag/spec/spec_helper.rb

44 lines
1.0 KiB
Ruby
Raw Normal View History

2015-10-25 21:21:46 +00:00
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
require 'jekyll'
require 'jekyll-seo-tag'
2015-10-31 18:05:19 +00:00
require 'html/proofer'
ENV["JEKYLL_LOG_LEVEL"] = "error"
def dest_dir
File.expand_path("../tmp/dest", File.dirname(__FILE__))
end
def source_dir
File.expand_path("./fixtures", File.dirname(__FILE__))
end
2015-10-25 21:21:46 +00:00
CONFIG_DEFAULTS = {
2015-10-31 18:05:19 +00:00
"source" => source_dir,
"destination" => dest_dir,
2015-10-25 21:21:46 +00:00
"gems" => ["jekyll-seo-tag"]
}
def page(options={})
page = Jekyll::Page.new site, CONFIG_DEFAULTS["source"], "", "page.md"
page.data = options
page
end
def post(options={})
2016-02-03 04:02:08 +00:00
filename = File.expand_path("2015-01-01-post.md", CONFIG_DEFAULTS["source"])
config = { :site => site, :collection => site.collections["posts"] }
page = Jekyll::Document.new filename, config
page.merge_data!(options)
2015-10-25 21:21:46 +00:00
page
end
def site(options={})
config = Jekyll.configuration CONFIG_DEFAULTS.merge(options)
Jekyll::Site.new(config)
end
def context(registers={})
Liquid::Context.new({}, {}, { :site => site, :page => page }.merge(registers))
end