' \
"This is index.md, the main markdown page.
\n" \
"We may use the following text attributes:
\n" \
"\n" \
"- italic
\n" \
"- bold
\n" \
"monospace
\n" \
"
\n" \
"We may produce an horizontal rule:
\n" \
"
\n" \
"Two spaces at the end of a line
\nproduce a line break.
\n" \
"\n" \
"Markdown uses email-style characters for blockquoting.
\n" \
"Multiple paragraphs need to be prepended individually.
\n" \
"
\n" \
'',
title: 'TITLE',
stylesheets: ['design/style.css'],
scripts: []
}
)
end
it 'should shift titles by one level to correctly fit in intranet page template' do
code, mime, content = @responder.generate_page('/filters/test-titles-shift-levels.html', {})
expect(code).to eql(206)
expect(mime).to eql('text/html')
expect(content).to eql(
{
content: '' \
"This page was generated using template.html
.
\n" \
"\n" \
"This is index.md, the main markdown page.
\n" \
"We may use the following text attributes:
\n" \
"\n" \
"- italic
\n" \
"- bold
\n" \
"monospace
\n" \
"
\n" \
"We may produce an horizontal rule:
\n" \
"
\n" \
"Two spaces at the end of a line
\nproduce a line break.
\n" \
"\n" \
"Markdown uses email-style characters for blockquoting.
\n" \
"Multiple paragraphs need to be prepended individually.
\n" \
"
\n" \
"\n" \
"End of template
\n" \
'',
title: 'TITLE',
stylesheets: ['design/style.css'],
scripts: []
}
)
end
end
context 'when asked for an existing picture' do
it 'should return the picture' do
# JPG file
code, mime, content = @responder.generate_page('/white.jpg', {})
expect(code).to eql(200)
expect(mime).to eql('image/jpeg')
expect(content).to eql(File.read(File.join(__dir__, 'testroot', 'white.jpg')))
# PNG file
code, mime, content = @responder.generate_page('/alpha.png', {})
expect(code).to eql(200)
expect(mime).to eql('image/png')
expect(content).to eql(File.read(File.join(__dir__, 'testroot', 'alpha.png')))
# SVG file
code, mime, content = @responder.generate_page('/decimal.svg', {})
expect(code).to eql(200)
expect(mime).to eql('image/svg+xml')
expect(content).to eql(File.read(File.join(__dir__, 'testroot', 'decimal.svg')))
end
end
context 'otherwise' do
it 'should return an HTTP 404 error' do
expect(@responder.generate_page('/filters/index.html', {})).to eql([404, '', ''])
expect(@responder.generate_page('index.html', {})).to eql([404, '', ''])
expect(@responder.generate_page('/black.jpg', {})).to eql([404, '', ''])
end
end
end
end