test/test_source.rb in pdd-0.12 vs test/test_source.rb in pdd-0.13
- old
+ new
@@ -67,6 +67,30 @@
PDD::VerboseSource.new(file, PDD::Source.new(file, 'hey')).puzzles
end
assert !error.message.index('Space expected').nil?
end
end
+
+ def test_reads_git_author
+ Dir.mktmpdir 'test' do |dir|
+ fail unless system("
+ set -e
+ cd '#{dir}'
+ git init .
+ git config user.email test@teamed.io
+ git config user.name test
+ echo '@todo #1 this is the puzzle' > a.txt
+ git add a.txt
+ git commit -am 'first version'
+ git blame a.txt
+ ")
+ list = PDD::Source.new(File.join(dir, 'a.txt'), '').puzzles
+ assert_equal 1, list.size
+ puzzle = list.first
+ assert_equal '1-1', puzzle.props[:lines]
+ assert_equal 'this is the puzzle', puzzle.props[:body]
+ assert_equal 'test', puzzle.props[:author]
+ assert_equal 'test@teamed.io', puzzle.props[:email]
+ assert !puzzle.props[:time].nil?
+ end
+ end
end