|
|
@@ -16,7 +16,8 @@ use gutenberg::{Site}; |
|
|
|
fn test_can_parse_site() { |
|
|
|
let mut path = env::current_dir().unwrap().to_path_buf(); |
|
|
|
path.push("test_site"); |
|
|
|
let site = Site::new(&path).unwrap(); |
|
|
|
let mut site = Site::new(&path).unwrap(); |
|
|
|
site.parse().unwrap(); |
|
|
|
|
|
|
|
// Correct number of pages (sections are pages too) |
|
|
|
assert_eq!(site.pages.len(), 10); |
|
|
@@ -88,6 +89,7 @@ fn test_can_build_site_without_live_reload() { |
|
|
|
let mut path = env::current_dir().unwrap().to_path_buf(); |
|
|
|
path.push("test_site"); |
|
|
|
let mut site = Site::new(&path).unwrap(); |
|
|
|
site.parse().unwrap(); |
|
|
|
let tmp_dir = TempDir::new("example").expect("create temp dir"); |
|
|
|
let public = &tmp_dir.path().join("public"); |
|
|
|
site.set_output_path(&public); |
|
|
@@ -127,6 +129,7 @@ fn test_can_build_site_with_live_reload() { |
|
|
|
let mut path = env::current_dir().unwrap().to_path_buf(); |
|
|
|
path.push("test_site"); |
|
|
|
let mut site = Site::new(&path).unwrap(); |
|
|
|
site.parse().unwrap(); |
|
|
|
let tmp_dir = TempDir::new("example").expect("create temp dir"); |
|
|
|
let public = &tmp_dir.path().join("public"); |
|
|
|
site.set_output_path(&public); |
|
|
@@ -163,6 +166,7 @@ fn test_can_build_site_with_categories() { |
|
|
|
let mut path = env::current_dir().unwrap().to_path_buf(); |
|
|
|
path.push("test_site"); |
|
|
|
let mut site = Site::new(&path).unwrap(); |
|
|
|
site.parse().unwrap(); |
|
|
|
|
|
|
|
for (i, page) in site.pages.values_mut().enumerate() { |
|
|
|
page.meta.category = if i % 2 == 0 { |
|
|
@@ -212,6 +216,7 @@ fn test_can_build_site_with_tags() { |
|
|
|
let mut path = env::current_dir().unwrap().to_path_buf(); |
|
|
|
path.push("test_site"); |
|
|
|
let mut site = Site::new(&path).unwrap(); |
|
|
|
site.parse().unwrap(); |
|
|
|
|
|
|
|
for (i, page) in site.pages.values_mut().enumerate() { |
|
|
|
page.meta.tags = if i % 2 == 0 { |
|
|
|