Skip to content

Commit a3022d0

Browse files
author
Hubot
committed
Sync changes from upstream repository
1 parent fbbdb7c commit a3022d0

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

spec/content/blog_date_spec.rb

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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+
end
18+
end
19+
end

0 commit comments

Comments
 (0)