Skip to content

Commit 0e0c8e9

Browse files
committed
Added spec to check some indents
1 parent dfabfc1 commit 0e0c8e9

File tree

2 files changed

+36
-0
lines changed

2 files changed

+36
-0
lines changed

spec/advisories_spec.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
require 'spec_helper'
22
require 'gem_advisory_example'
33
require 'ruby_advisory_example'
4+
require 'check_indents'
45

56
describe "gems" do
67
Dir.glob(File.join(ROOT,'gems/*/*')) do |path|

spec/check_indents.rb

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
require "yaml"
2+
3+
RSpec.describe "Check Advisory indentation formatting" do
4+
Dir.glob("gems/**/**/*.yml").each do |file|
5+
context file do
6+
let(:lines) { File.readlines(file) }
7+
8+
it "does not contain lines starting with '- '" do
9+
bad = lines.select { |l| l.match?(/^- /) }
10+
expect(bad).to be_empty, "Found lines starting with '- ':\n#{bad.join}"
11+
end
12+
13+
it "does not contain lines starting with ' - http'" do
14+
bad = lines.select { |l| l.match?(/^ - http/) }
15+
expect(bad).to be_empty, "Found lines starting with ' - http':\n#{bad.join}"
16+
end
17+
end
18+
end
19+
20+
Dir.glob("rubies/**/**/*.yml").each do |file|
21+
context file do
22+
let(:lines) { File.readlines(file) }
23+
24+
it "does not contain lines starting with '- '" do
25+
bad = lines.select { |l| l.match?(/^- /) }
26+
expect(bad).to be_empty, "Found lines starting with '- ':\n#{bad.join}"
27+
end
28+
29+
it "does not contain lines starting with ' - http'" do
30+
bad = lines.select { |l| l.match?(/^ - http/) }
31+
expect(bad).to be_empty, "Found lines starting with ' - http':\n#{bad.join}"
32+
end
33+
end
34+
end
35+
end

0 commit comments

Comments
 (0)