`Serve.process` should receive same config as `Build.process`

fixes #4850
This commit is contained in:
Florian Thomas 2016-05-26 22:24:04 +02:00
parent 746e360c63
commit f8c038566c
2 changed files with 16 additions and 0 deletions

View File

@ -33,7 +33,9 @@ module Jekyll
cmd.action do |_, opts|
opts["serving"] = true
opts["watch" ] = true unless opts.key?("watch")
config = opts["config"]
Build.process(opts)
opts["config"] = config
Serve.process(opts)
end
end

View File

@ -74,6 +74,20 @@ class TestCommandsServe < JekyllUnitTest
assert custom_opts(opts)[:DirectoryIndex].empty?
end
should "keep config between build and serve" do
custom_options = {
"config" => %w(_config.yml _development.yml),
"serving" => true,
"watch" => false # for not having guard output when running the tests
}
allow(SafeYAML).to receive(:load_file).and_return({})
allow(Jekyll::Commands::Build).to receive(:build).and_return("")
expect(Jekyll::Commands::Serve).to receive(:process).with(custom_options)
@merc.execute(:serve, { "config" => %w(_config.yml _development.yml),
"watch" => false })
end
context "verbose" do
should "debug when verbose" do
assert_equal custom_opts({ "verbose" => true })[:Logger].level, 5