File tree Expand file tree Collapse file tree 2 files changed +16
-5
lines changed Expand file tree Collapse file tree 2 files changed +16
-5
lines changed Original file line number Diff line number Diff line change 1
1
require 'spec_helper'
2
2
3
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
4
it 'is not in the past' do
9
- @ posts. each do |post |
5
+ posts . each do |post |
10
6
matches = post . match ( %r{(\d {4}-\d {2}-\d {2})-} )
11
7
next unless matches
12
8
Original file line number Diff line number Diff line change 11
11
12
12
Dir . glob ( 'tasks/*.rake' ) . each { |r | load r }
13
13
14
+ # All the blog posts we're interested in checking. This means we're looking at
15
+ # files that have changed on this particular branch we're on.
16
+ #
17
+ # Returns an Array of String filenames.
18
+ def posts
19
+ return @posts if defined? @posts
20
+
21
+ diffable_files = `git diff -z --name-only --diff-filter=ACMRTUXB origin/master` . split ( "\0 " )
22
+
23
+ @posts = diffable_files . select do |filename |
24
+ ext = File . extname ( filename )
25
+ ext == ".md" || ext == ".html"
26
+ end
27
+ end
28
+
14
29
# this does the file serving
15
30
class ImplictIndex
16
31
def initialize (root )
You can’t perform that action at this time.
0 commit comments