-
Notifications
You must be signed in to change notification settings - Fork 630
/
Copy pathtest_linter_invalid_release_data.rb
60 lines (47 loc) · 1.34 KB
/
test_linter_invalid_release_data.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# frozen_string_literal: true
require "helper"
require "linter"
describe Linter do
before do
chdir_tempdir
end
after do
teardown_tempdir
end
it "reports release data with missing post URL" do
content = <<~YAML
- version: 2.7.1
date: 2020-01-01
post:
YAML
create_file("_data/releases.yml", content)
_(linter_output).must_match "post URL with unexpected format"
end
it "reports release data with malformed post URL" do
content = <<~YAML
- version: 2.7.2
date: 2020-01-01
post: /en/news/2020-01-01/malformed-post-url/
YAML
create_file("_data/releases.yml", content)
_(linter_output).must_match "post URL with unexpected format"
end
it "reports release data with missing release post" do
content = <<~YAML
- version: 2.7.3
date: 2020-01-01
post: /en/news/2020/01/01/missing/
YAML
create_file("_data/releases.yml", content)
_(linter_output).must_match "no release post file that matches given post URL"
end
it "reports release data with dates that do not match" do
content = <<~YAML
- version: 2.7.4
date: 2020-01-01
post: /en/news/2020/01/02/wrong-date/
YAML
create_file("_data/releases.yml", content)
_(linter_output).must_match "release date and post date do not match"
end
end