We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent fbbdb7c commit a3022d0Copy full SHA for a3022d0
spec/content/blog_date_spec.rb
@@ -0,0 +1,19 @@
1
+require 'spec_helper'
2
+
3
+describe 'Blog Date' do
4
+ before do
5
+ @posts = `git diff --name-only --diff-filter=ACMRTUXB master... | grep .md`.split("\n")
6
+ end
7
8
+ it 'is not in the past' do
9
+ @posts.each do |post|
10
+ matches = post.match(%r{(\d{4}-\d{2}-\d{2})-})
11
+ next unless matches
12
13
+ date = Date.parse matches[1]
14
+ today_pst = Time.now.getlocal('-08:00')
15
+ today_date = Date.parse(today_pst.strftime('%Y-%m-%d'))
16
+ fail "#{post} has a date in the past." if date < today_date
17
18
19
+end
0 commit comments