1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
|
# frozen_string_literal: true
require "jekyll"
require File.expand_path("lib/jekyll-redirect-from.rb")
RSpec.configure do |config|
config.run_all_when_everything_filtered = true
config.filter_run :focus
config.expect_with :rspec do |c|
c.syntax = :expect
end
config.before(:each) do
Jekyll.logger.log_level = :error
dest_path.rmtree if dest_path.exist?
site.reset
end
config.after(:each) do
dest_path.rmtree if dest_path.exist?
end
def fixtures_path
Pathname.new(__dir__).join("fixtures")
end
def dest_path
Pathname.new(site.dest)
end
def dest_dir(*paths)
dest_path.join(*paths)
end
def config
Jekyll.configuration(
"source" => fixtures_path.to_s,
"destination" => fixtures_path.join("_site").to_s,
"collections" => {
"articles" => { "output" => true },
"authors" => {},
},
"url" => "http://jekyllrb.com",
"plugins" => [
"jekyll-redirect-from",
"jekyll-sitemap",
],
"defaults" => [{
"scope" => { "path" => "" },
"values" => { "layout" => "layout" },
}]
)
end
def site
@site ||= Jekyll::Site.new(config)
end
end
|