tildy/spec/main_spec.cr

31 lines
1019 B
Crystal

require "spec"
require "../main"
describe Blog do
it "generates correct content to index" do
Blog.new(
Config.new("./spec/test_config.yml"),
PostRepository.new(
Config.new("./spec/test_config.yml")
).all
).compile
File.read("./spec/public/index.html").should eq File.read("./spec/expected/index.html")
File.read("./spec/public/posts/20200202/index.html").should eq File.read("./spec/expected/posts/20200202/index.html")
File.read("./spec/public/tags/tag1/index.html").should eq File.read("./spec/expected/tags/tag1/index.html")
File.read("./spec/public/tags/tag2/index.html").should eq File.read("./spec/expected/tags/tag2/index.html")
end
end
describe RSSFeed do
it "generates correct content for rss" do
RSSFeed.new(
Config.new("./spec/test_config.yml"),
PostRepository.new(
Config.new("./spec/test_config.yml")
).all
).compile
File.read("./spec/public/rss.xml").should eq File.read("./spec/expected/rss.xml")
end
end