fix(log): Don't fail on non-string custom fields
This commit is contained in:
parent
7783b79e73
commit
c42a52abbf
@ -79,7 +79,7 @@ module Jekyll
|
||||
# Convert all variables
|
||||
content = File.open(file).read
|
||||
metadata.each do |key, value|
|
||||
content = content.gsub("{#{key}}", value)
|
||||
content = content.gsub("{#{key}}", value.to_s)
|
||||
end
|
||||
|
||||
# Display each line differently
|
||||
|
||||
@ -27,6 +27,24 @@ describe(Jekyll::Algolia::Logger) do
|
||||
expect(current).to have_received(:log).with('I: Info line my_index')
|
||||
expect(current).to have_received(:log).with('W: Warning line')
|
||||
end
|
||||
|
||||
context 'with non-string metadata' do
|
||||
describe do
|
||||
let(:metadata) { { 'index_name' => false } }
|
||||
it do
|
||||
expect(current).to have_received(:log).with('I: Info line false')
|
||||
end
|
||||
end
|
||||
|
||||
describe do
|
||||
let(:metadata) { { 'index_name' => %w[foo bar] } }
|
||||
it do
|
||||
expect(current)
|
||||
.to have_received(:log)
|
||||
.with('I: Info line ["foo", "bar"]')
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe '.log' do
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user