~duncan-bayne/halp

784c332650223b60ecbf85ecb78b1e2850255cca — Duncan Bayne 6 months ago 1d40349
Don't concatenate Web path since we don't support relative paths
2 files changed, 7 insertions(+), 3 deletions(-)

M lib/Halp/AtomFeed.pm
M t/Halp/atom_feed_test.t
M lib/Halp/AtomFeed.pm => lib/Halp/AtomFeed.pm +2 -2
@@ 29,8 29,8 @@ sub feed_for {
	my $full_path = $file->{filename};
	if (-f $full_path) {
	    my $contents = read_file($full_path);
	    $feed_directory = File::Spec->catfile($web_path, dirname($full_path));
	    my $relative_path = rel2abs($full_path, $web_path);
	    $feed_directory = dirname($full_path);
	    my $relative_path = rel2abs($feed_directory, $web_path);
	    $updated_at = `cd $feed_directory; git log --reverse --pretty='format:%ad' --date=iso8601-strict -- $relative_path | head -1`;
	    chomp($updated_at);


M t/Halp/atom_feed_test.t => t/Halp/atom_feed_test.t +5 -1
@@ 11,7 11,11 @@ use Test::More;

use Test::More tests => 8;

my $feed = feed_for('/atom_feed/feed.xml', './t/fixtures/atom_feed/feed.xml', rel2abs('.'), 'example.com', {email => 'author@example.com', name => 'An Author'});
my $feed = feed_for('/feed.xml',
		    rel2abs('./t/fixtures/atom_feed/feed.xml'),
		    'example.com',
		    {email => 'author@example.com', name => 'An Author'});

my $xml = Mojo::DOM->new->xml(1)->parse($feed);

is($xml->at('feed')->at('title')->text, 'Test Title', 'The Atom feed has the correct title.');