Skip to content
This repository has been archived by the owner on Jun 25, 2020. It is now read-only.

Changed date guessing heuristic to use last modification time of posts instead of current time, if no better data is available. #259

Merged
merged 2 commits into from
Aug 8, 2015

Conversation

kodfodrasz
Copy link
Contributor

Changed date guessing heuristic to use last modification time of posts instead of current time, if no better data is available.

This is a viable and better replacement as all filesystems track this, and git and other version control tools also keep track of this and set it on files on checkout.

The changes:

…s instead of current time, if no better data is available.

 - Instead of DateTime.Now the source file's LastWriteTime is used now
 - The tests were updated
 - Updated System.IO.Abstractions and TestingHelpers to version 2.0.0.116
   to avoid a bug in the System.IO.Abstractions.TestingHelpers library
   making tests to fail
   (see: TestableIO/System.IO.Abstractions#122 )
@@ -791,21 +807,25 @@ public void page_with_false_date_in_title()
[Fact]
public void post_default_values()
{
fileSystem.AddFile(@"C:\TestSite\_posts\SomeFile.md", new MockFileData(@"---
var filename = @"C:\TestSite\SomeFile.md";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the change from Posts to Pages?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because the test failed. The test failed because the Posts get populated from _posts, Pages gets populated from anywhere in the site source. The path in the test vectors was not in the _posts folder (which made me wonder why the tests didn't fail earlier...). Instead of wasting hours, i changed it.

I hope I have not misunderstood something.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well the file path was modified from "C:\TestSite_posts\SomeFile.md" to "C:\TestSite\SomeFile.md" so it's normal that Posts is empty, but why change the file path?

@laedit
Copy link
Member

laedit commented Aug 5, 2015

Good one, thanks a lot!
I just have some question about the tests modifications.

@kodfodrasz
Copy link
Contributor Author

I have addressed your comments. They were totally rightful. Sorry for them, I have just recently pulled some of my changes together from my sandbox branch, and decided to send them. This PR was only sandbox-quality.

@laedit
Copy link
Member

laedit commented Aug 8, 2015

No problem, thanks again for your work! 😃

laedit pushed a commit that referenced this pull request Aug 8, 2015
Changed date guessing heuristic to use last modification time of posts instead of current time, if no better data is available.
@laedit laedit merged commit ae47e81 into Code52:master Aug 8, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants