danger-changelog 0.4.1 → 0.4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop_todo.yml +1 -1
- data/CHANGELOG.md +4 -0
- data/danger-changelog.gemspec +1 -0
- data/lib/changelog/changelog_line/changelog_header_line.rb +1 -1
- data/lib/changelog/gem_version.rb +1 -1
- data/spec/changelog_entry_line_spec.rb +43 -97
- data/spec/changelog_header_line_spec.rb +84 -136
- data/spec/changelog_placeholder_line_spec.rb +9 -44
- data/spec/fixtures/changelogs/semver.md +0 -6
- data/spec/spec_helper.rb +6 -0
- data/spec/support/shared/changelog.rb +41 -0
- metadata +18 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 450307fc09c7eaaa1c231f41cd538c3a77ec15b466bcfb0f1e0bd0bbe5948376
|
4
|
+
data.tar.gz: 5c59cc348309c6f0b244ee9316ebe9d95b4850bb6a33d4aaf9588947866d3702
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3b117b228586220f9ca929114e838d6811837daff83c0b5822de7283806d607ba66be2f37f393bb0d7b630914487b18b55b74ac79ce52ea2bffb94193b53b671
|
7
|
+
data.tar.gz: a4538cb355fa4039ce90715456b16b850fc9e9fc7713b73fd411e8c1f3070ed486c8ab725548921940d762c7af42a35ed43ac305b62e75983933ff4d9763b2e5
|
data/.rubocop_todo.yml
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# This configuration was generated by
|
2
2
|
# `rubocop --auto-gen-config`
|
3
|
-
# on 2018-12-20
|
3
|
+
# on 2018-12-20 16:02:35 -0500 using RuboCop version 0.61.1.
|
4
4
|
# The point is for the user to remove these configuration records
|
5
5
|
# one by one as the offenses are removed from the code base.
|
6
6
|
# Note that changes in the inspected code, or installation of new
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
## Changelog
|
2
2
|
|
3
|
+
### 0.4.2 (2018/12/21)
|
4
|
+
|
5
|
+
* [#37](https://github.com/dblock/danger-changelog/issues/37): Allow for parenthesis and brackets around headers - [@dblock](https://github.com/dblock).
|
6
|
+
|
3
7
|
### 0.4.1 (2018/12/20)
|
4
8
|
|
5
9
|
* [#37](https://github.com/dblock/danger-changelog/issues/37): Allow for parenthesis and brackets around versions and dates - [@dblock](https://github.com/dblock).
|
data/danger-changelog.gemspec
CHANGED
@@ -19,6 +19,7 @@ Gem::Specification.new do |spec|
|
|
19
19
|
|
20
20
|
spec.add_runtime_dependency 'danger-plugin-api', '~> 1.0'
|
21
21
|
|
22
|
+
spec.add_development_dependency 'activesupport'
|
22
23
|
spec.add_development_dependency 'bundler', '~> 1.3'
|
23
24
|
spec.add_development_dependency 'guard', '~> 2.14'
|
24
25
|
spec.add_development_dependency 'guard-rspec', '~> 4.7'
|
@@ -12,7 +12,7 @@ module Danger
|
|
12
12
|
def valid?
|
13
13
|
stripped_line = line.strip
|
14
14
|
|
15
|
-
m = stripped_line.match(/^#{HASHES}\s[\w\s\:]
|
15
|
+
m = stripped_line.match(/^#{HASHES}\s#{OPEN_PARENS}[\w\s\:]*#{CLOSE_PARENS}$/) # title
|
16
16
|
m ||= stripped_line.match(/^#{HASHES}\s#{OPEN_PARENS}#{SEMVER}#{CLOSE_PARENS}$/) # semver only
|
17
17
|
m ||= stripped_line.match(/^#{HASHES}\s#{OPEN_PARENS}#{SEMVER}#{CLOSE_PARENS}[\s\-]+#{OPEN_PARENS}(#{ISO8601_DATE}|\w*)#{CLOSE_PARENS}$/) # semver and iso 8601 date or next version description
|
18
18
|
|
@@ -1,163 +1,109 @@
|
|
1
1
|
require File.expand_path('spec_helper', __dir__)
|
2
2
|
|
3
3
|
describe Danger::Changelog::ChangelogEntryLine do
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
expect(described_class.validates_as_changelog_line?(' - [@dblock](https://github.com/dblock).')).to be false
|
23
|
-
expect(described_class.validates_as_changelog_line?('[#1](https://github.com/dblock/danger-changelog/pull/1).')).to be false
|
24
|
-
expect(described_class.validates_as_changelog_line?('[#1](https://github.com/dblock/danger-changelog/pull/1): ')).to be false
|
25
|
-
end
|
26
|
-
end
|
4
|
+
it_behaves_like 'validates as changelog entry line', '* Valid without PR link - [@dblock](https://github.com/dblock).'
|
5
|
+
it_behaves_like 'validates as changelog entry line', '* Valid without PR link - [@dblock](https://github.com/dblock).'
|
6
|
+
it_behaves_like 'validates as changelog entry line', '* [#1](https://github.com/dblock/danger-changelog/pull/1): Valid with PR link - [@dblock](https://github.com/dblock).'
|
7
|
+
it_behaves_like 'validates as changelog entry line', 'Missing star - [@dblock](https://github.com/dblock).'
|
8
|
+
it_behaves_like 'validates as changelog entry line', '* [#1](https://github.com/dblock/danger-changelog/pull/1) - Not a colon - [@dblock](https://github.com/dblock).'
|
9
|
+
it_behaves_like 'validates as changelog entry line', '* [#1](https://github.com/dblock/danger-changelog/pull/1): No dash [@dblock](https://github.com/dblock).'
|
10
|
+
it_behaves_like 'validates as changelog entry line', '* [#1](https://github.com/dblock/danger-changelog/pull/1): No final period - [@dblock](https://github.com/dblock)'
|
11
|
+
it_behaves_like 'validates as changelog entry line', '* [#1](https://github.com/dblock/danger-changelog/pull/1): No name.'
|
12
|
+
it_behaves_like 'validates as changelog entry line', '* [#1](https://github.com/dblock/danger-changelog/pull/1): No https in github - [@dblock](http://github.com/dblock).'
|
13
|
+
it_behaves_like 'validates as changelog entry line', '* [#1](https://github.com/dblock/danger-changelog/pull/1): Extra trailing slash - [@dblock](https://github.com/dblock/).'
|
14
|
+
it_behaves_like 'validates as changelog entry line', '# [#1](https://github.com/dblock/danger-changelog/pull/1): Hash instead of star - [@dblock](https://github.com/dblock).'
|
15
|
+
|
16
|
+
it_behaves_like 'does not validate as changelog entry line', 'Missing star, PR and author link.'
|
17
|
+
it_behaves_like 'does not validate as changelog entry line', '* '
|
18
|
+
it_behaves_like 'does not validate as changelog entry line', '[@dblock](https://github.com/dblock).'
|
19
|
+
it_behaves_like 'does not validate as changelog entry line', ' - [@dblock](https://github.com/dblock).'
|
20
|
+
it_behaves_like 'does not validate as changelog entry line', '[#1](https://github.com/dblock/danger-changelog/pull/1).'
|
21
|
+
it_behaves_like 'does not validate as changelog entry line', '[#1](https://github.com/dblock/danger-changelog/pull/1): '
|
27
22
|
|
28
23
|
context 'changelog entry line' do
|
29
24
|
context 'when without PR link' do
|
30
|
-
|
31
|
-
|
32
|
-
it 'is valid' do
|
33
|
-
expect(subject.valid?).to be true
|
34
|
-
end
|
25
|
+
it_behaves_like 'valid changelog entry line', '* Valid without PR link - [@antondomashnev](https://github.com/antondomashnev).'
|
35
26
|
end
|
36
27
|
|
37
28
|
context 'when with PR link' do
|
38
|
-
|
39
|
-
|
40
|
-
it 'is valid' do
|
41
|
-
expect(subject.valid?).to be true
|
42
|
-
end
|
29
|
+
it_behaves_like 'valid changelog entry line', '* [#1](https://github.com/dblock/danger-changelog/pull/1): Valid with PR link - [@dblock](https://github.com/dblock).'
|
43
30
|
end
|
44
31
|
|
45
32
|
context 'when missing star' do
|
46
|
-
|
47
|
-
|
48
|
-
it 'is invalid' do
|
49
|
-
expect(subject.invalid?).to be true
|
50
|
-
end
|
33
|
+
it_behaves_like 'invalid changelog entry line', 'Missing star - [@dblock](https://github.com/dblock).'
|
51
34
|
end
|
52
35
|
|
53
36
|
context 'when not a colon' do
|
54
|
-
|
55
|
-
|
56
|
-
it 'is invalid' do
|
57
|
-
expect(subject.invalid?).to be true
|
58
|
-
end
|
37
|
+
it_behaves_like 'invalid changelog entry line', '* [#1](https://github.com/dblock/danger-changelog/pull/1) - Not a colon - [@dblock](https://github.com/dblock).'
|
59
38
|
end
|
60
39
|
|
61
40
|
context 'when no dash' do
|
62
|
-
|
63
|
-
|
64
|
-
it 'is invalid' do
|
65
|
-
expect(subject.invalid?).to be true
|
66
|
-
end
|
41
|
+
it_behaves_like 'invalid changelog entry line', '* [#1](https://github.com/dblock/danger-changelog/pull/1): No dash [@dblock](https://github.com/dblock).'
|
67
42
|
end
|
68
43
|
|
69
44
|
context 'when no final period' do
|
70
|
-
|
71
|
-
|
72
|
-
it 'is invalid' do
|
73
|
-
expect(subject.invalid?).to be true
|
74
|
-
end
|
45
|
+
it_behaves_like 'invalid changelog entry line', '* [#1](https://github.com/dblock/danger-changelog/pull/1): No final period - [@dblock](https://github.com/dblock)'
|
75
46
|
end
|
76
47
|
|
77
48
|
context 'when no name' do
|
78
|
-
|
79
|
-
|
80
|
-
it 'is invalid' do
|
81
|
-
expect(subject.invalid?).to be true
|
82
|
-
end
|
49
|
+
it_behaves_like 'invalid changelog entry line', '* [#1](https://github.com/dblock/danger-changelog/pull/1): No name.'
|
83
50
|
end
|
84
51
|
|
85
52
|
context 'when no https in GitHub' do
|
86
|
-
|
87
|
-
|
88
|
-
it 'is invalid' do
|
89
|
-
expect(subject.invalid?).to be true
|
90
|
-
end
|
53
|
+
it_behaves_like 'invalid changelog entry line', '* [#1](https://github.com/dblock/danger-changelog/pull/1): No https in github - [@dblock](http://github.com/dblock).'
|
91
54
|
end
|
92
55
|
|
93
56
|
context 'when extra trailing slash' do
|
94
|
-
|
95
|
-
|
96
|
-
it 'is invalid' do
|
97
|
-
expect(subject.invalid?).to be true
|
98
|
-
end
|
57
|
+
it_behaves_like 'invalid changelog entry line', '* [#1](https://github.com/dblock/danger-changelog/pull/1): Extra trailing slash - [@dblock](https://github.com/dblock/).'
|
99
58
|
end
|
100
59
|
|
101
60
|
context 'when extra period' do
|
102
|
-
|
103
|
-
|
104
|
-
it 'is invalid' do
|
105
|
-
expect(subject.invalid?).to be true
|
106
|
-
end
|
61
|
+
it_behaves_like 'invalid changelog entry line', '* [#1](https://github.com/dblock/danger-changelog/pull/1): Extra period. - [@dblock](https://github.com/dblock).'
|
107
62
|
end
|
108
63
|
|
109
64
|
context 'when extra colon' do
|
110
|
-
|
111
|
-
|
112
|
-
it 'is invalid' do
|
113
|
-
expect(subject.invalid?).to be true
|
114
|
-
end
|
65
|
+
it_behaves_like 'invalid changelog entry line', '* [#1](https://github.com/dblock/danger-changelog/pull/1): Extra colon, - [@dblock](https://github.com/dblock).'
|
115
66
|
end
|
116
67
|
|
117
68
|
context 'when extra hash' do
|
118
|
-
|
119
|
-
|
120
|
-
it 'is valid' do
|
121
|
-
expect(subject.valid?).to be true
|
122
|
-
end
|
69
|
+
it_behaves_like 'valid changelog entry line', '* [#1](https://github.com/dblock/danger-changelog/pull/1): With # - [@dblock](https://github.com/dblock).'
|
123
70
|
end
|
124
71
|
|
125
72
|
context 'when with question mark' do
|
126
|
-
|
127
|
-
|
128
|
-
it 'is valid' do
|
129
|
-
expect(subject.valid?).to be true
|
130
|
-
end
|
73
|
+
it_behaves_like 'valid changelog entry line', '* [#1](https://github.com/dblock/danger-changelog/pull/1): With ? - [@dblock](https://github.com/dblock).'
|
131
74
|
end
|
132
75
|
|
133
76
|
context 'when hash instead of star' do
|
134
|
-
|
135
|
-
|
136
|
-
it 'is invalid' do
|
137
|
-
expect(subject.invalid?).to be true
|
138
|
-
end
|
77
|
+
it_behaves_like 'invalid changelog entry line', '# [#1](https://github.com/dblock/danger-changelog/pull/1): Hash instead of star - [@dblock](https://github.com/dblock).'
|
139
78
|
end
|
140
79
|
end
|
141
80
|
|
142
81
|
context 'example' do
|
143
82
|
let(:github) do
|
144
|
-
double(
|
145
|
-
|
146
|
-
|
147
|
-
|
83
|
+
double(
|
84
|
+
Danger::RequestSources::GitHub,
|
85
|
+
pr_json: {
|
86
|
+
'number' => 123, 'html_url' => 'https://github.com/dblock/danger-changelog/pull/123'
|
87
|
+
},
|
88
|
+
pr_author: 'dblock',
|
89
|
+
pr_title: pr_title
|
90
|
+
)
|
148
91
|
end
|
92
|
+
|
149
93
|
context 'no transformation required' do
|
150
94
|
let(:pr_title) { 'Test' }
|
151
95
|
it 'uses title as is' do
|
152
96
|
expect(described_class.example(github)).to eq '* [#123](https://github.com/dblock/danger-changelog/pull/123): Test - [@dblock](https://github.com/dblock).'
|
153
97
|
end
|
154
98
|
end
|
99
|
+
|
155
100
|
context 'with lowercase title' do
|
156
101
|
let(:pr_title) { 'test' }
|
157
102
|
it 'capitalizes it' do
|
158
103
|
expect(described_class.example(github)).to eq '* [#123](https://github.com/dblock/danger-changelog/pull/123): Test - [@dblock](https://github.com/dblock).'
|
159
104
|
end
|
160
105
|
end
|
106
|
+
|
161
107
|
context 'with a trailing period' do
|
162
108
|
let(:pr_title) { 'Test.' }
|
163
109
|
it 'removes it' do
|
@@ -1,145 +1,93 @@
|
|
1
1
|
require File.expand_path('spec_helper', __dir__)
|
2
2
|
|
3
3
|
describe Danger::Changelog::ChangelogHeaderLine do
|
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
|
-
it 'is valid' do
|
53
|
-
expect(subject.valid?).to be false
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
context 'when two hash symbols' do
|
58
|
-
subject { Danger::Changelog::ChangelogHeaderLine.new('## 1.0.1') }
|
59
|
-
|
60
|
-
it 'is valid' do
|
61
|
-
expect(subject.valid?).to be true
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
|
-
context 'when three hash symbols' do
|
66
|
-
subject { Danger::Changelog::ChangelogHeaderLine.new('### Lollypop') }
|
67
|
-
|
68
|
-
it 'is valid' do
|
69
|
-
expect(subject.valid?).to be true
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
|
-
context 'when four hash symbols' do
|
74
|
-
subject { Danger::Changelog::ChangelogHeaderLine.new('#### Four hashes is too much') }
|
75
|
-
|
76
|
-
it 'is valid' do
|
77
|
-
expect(subject.valid?).to be true
|
78
|
-
end
|
79
|
-
end
|
80
|
-
|
81
|
-
context 'when no hash symbol' do
|
82
|
-
subject { Danger::Changelog::ChangelogHeaderLine.new('* Star is invalid.') }
|
83
|
-
|
84
|
-
it 'is invalid' do
|
85
|
-
expect(subject.invalid?).to be true
|
86
|
-
end
|
87
|
-
end
|
88
|
-
|
89
|
-
context 'when star instead of hash symbol' do
|
90
|
-
subject { Danger::Changelog::ChangelogHeaderLine.new('* Star is invalid.') }
|
91
|
-
|
92
|
-
it 'is invalid' do
|
93
|
-
expect(subject.invalid?).to be true
|
94
|
-
end
|
95
|
-
end
|
96
|
-
|
97
|
-
context 'when no hash symbol' do
|
98
|
-
subject { Danger::Changelog::ChangelogHeaderLine.new('It requires hash symbol.') }
|
99
|
-
|
100
|
-
it 'is invalid' do
|
101
|
-
expect(subject.invalid?).to be true
|
102
|
-
end
|
103
|
-
end
|
104
|
-
|
105
|
-
context 'when hash symbol without space' do
|
106
|
-
subject { Danger::Changelog::ChangelogHeaderLine.new('###Lollypop') }
|
107
|
-
|
108
|
-
it 'is invalid' do
|
109
|
-
expect(subject.invalid?).to be true
|
110
|
-
end
|
111
|
-
end
|
112
|
-
|
113
|
-
context 'when hash symbol without header title' do
|
114
|
-
subject { Danger::Changelog::ChangelogHeaderLine.new('### ') }
|
115
|
-
|
116
|
-
it 'is invalid' do
|
117
|
-
expect(subject.invalid?).to be true
|
118
|
-
end
|
119
|
-
end
|
4
|
+
it_behaves_like 'validates as changelog header line', '# 1.0.1'
|
5
|
+
it_behaves_like 'validates as changelog header line', '## Version 1.0.1'
|
6
|
+
it_behaves_like 'validates as changelog header line', '### three hashes'
|
7
|
+
it_behaves_like 'validates as changelog header line', '#### Four hashes is too much'
|
8
|
+
it_behaves_like 'does not validate as changelog header line', 'something else'
|
9
|
+
|
10
|
+
it_behaves_like 'valid changelog header line', '# 1.0.1'
|
11
|
+
it_behaves_like 'valid changelog header line', '### Lollypop'
|
12
|
+
|
13
|
+
it_behaves_like 'invalid changelog header line', '# 1.0.1 (1/2/3)'
|
14
|
+
it_behaves_like 'invalid changelog header line', '* Star is invalid.'
|
15
|
+
it_behaves_like 'invalid changelog header line', '* Star is invalid.'
|
16
|
+
it_behaves_like 'invalid changelog header line', 'It requires a hash symbol'
|
17
|
+
it_behaves_like 'invalid changelog header line', '1.1.1'
|
18
|
+
it_behaves_like 'invalid changelog header line', 'Version 2.0.1'
|
19
|
+
it_behaves_like 'invalid changelog header line', '#'
|
20
|
+
it_behaves_like 'invalid changelog header line', '## '
|
21
|
+
it_behaves_like 'invalid changelog header line', '##### I can not validate five'
|
22
|
+
|
23
|
+
it_behaves_like 'valid changelog header line', '# 1.0.1 (Next)'
|
24
|
+
|
25
|
+
context 'ISO 8601 format date' do
|
26
|
+
it_behaves_like 'valid changelog header line', '# 1.0.1 (2018/1/2)'
|
27
|
+
end
|
28
|
+
|
29
|
+
context 'date not in ISO 8601 format' do
|
30
|
+
it_behaves_like 'invalid changelog header line', '# 1.0.1 (1/2/2018)'
|
31
|
+
end
|
32
|
+
|
33
|
+
context 'two hash symbols' do
|
34
|
+
it_behaves_like 'valid changelog header line', '## 1.0.1'
|
35
|
+
end
|
36
|
+
|
37
|
+
context 'three hash symbols' do
|
38
|
+
it_behaves_like 'valid changelog header line', '### Lollypop'
|
39
|
+
end
|
40
|
+
|
41
|
+
context 'four hash symbols' do
|
42
|
+
it_behaves_like 'valid changelog header line', '#### Four hashes is too much'
|
43
|
+
end
|
44
|
+
|
45
|
+
context 'when no hash symbol' do
|
46
|
+
it_behaves_like 'invalid changelog header line', '* Star is invalid.'
|
47
|
+
end
|
48
|
+
|
49
|
+
context 'when star instead of hash symbol' do
|
50
|
+
it_behaves_like 'invalid changelog header line', '* Star is invalid.'
|
51
|
+
end
|
120
52
|
|
121
|
-
|
122
|
-
|
53
|
+
context 'when no hash symbol' do
|
54
|
+
it_behaves_like 'invalid changelog header line', 'It requires hash symbol.'
|
55
|
+
end
|
56
|
+
|
57
|
+
context 'when hash symbol without space' do
|
58
|
+
it_behaves_like 'invalid changelog header line', '###Lollypop'
|
59
|
+
end
|
123
60
|
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
end
|
128
|
-
|
129
|
-
context 'with a string as semver' do
|
130
|
-
subject { Danger::Changelog::ChangelogHeaderLine.new('# Invalid (Next)') }
|
61
|
+
context 'when hash symbol without header title' do
|
62
|
+
it_behaves_like 'invalid changelog header line', '### '
|
63
|
+
end
|
131
64
|
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
65
|
+
context 'when five hash symbols' do
|
66
|
+
it_behaves_like 'invalid changelog header line', '##### Tooooo much'
|
67
|
+
end
|
68
|
+
|
69
|
+
context 'with a string as semver' do
|
70
|
+
it_behaves_like 'invalid changelog header line', '# Invalid (Next)'
|
71
|
+
end
|
72
|
+
|
73
|
+
context 'with an invalid semver' do
|
74
|
+
it_behaves_like 'invalid changelog header line', '# 0.1.'
|
75
|
+
end
|
76
|
+
|
77
|
+
context 'with a colon' do
|
78
|
+
it_behaves_like 'valid changelog header line', '### Changed:'
|
79
|
+
end
|
80
|
+
|
81
|
+
context 'in brackets' do
|
82
|
+
it_behaves_like 'valid changelog header line', '### [Unreleased]'
|
83
|
+
end
|
139
84
|
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
85
|
+
context 'in parenthesis' do
|
86
|
+
it_behaves_like 'valid changelog header line', '### (Unreleased)'
|
87
|
+
it_behaves_like 'invalid changelog header line', '### (Unreleased'
|
88
|
+
it_behaves_like 'invalid changelog header line', '### Unreleased)'
|
89
|
+
it_behaves_like 'invalid changelog header line', '### [Unreleased'
|
90
|
+
it_behaves_like 'invalid changelog header line', '### (Unreleased]'
|
91
|
+
it_behaves_like 'invalid changelog header line', '### Unreleased]'
|
144
92
|
end
|
145
93
|
end
|
@@ -8,36 +8,14 @@ describe Danger::Changelog::ChangelogPlaceholderLine do
|
|
8
8
|
end
|
9
9
|
end
|
10
10
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
expect(described_class.validates_as_changelog_line?("* Nothing yet here.\n")).to be true
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
context 'when line is not equal to placeholder_line from config' do
|
19
|
-
it 'validates as changelog line' do
|
20
|
-
expect(described_class.validates_as_changelog_line?("* Put your contribution here.\n")).to be false
|
21
|
-
end
|
22
|
-
end
|
11
|
+
context 'when line is equal to placeholder_line from config' do
|
12
|
+
it_behaves_like 'validates as changelog placeholder line', "* Nothing yet here.\n"
|
13
|
+
it_behaves_like 'valid changelog placeholder line', "* Nothing yet here.\n"
|
23
14
|
end
|
24
15
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
it 'is valid' do
|
30
|
-
expect(subject.valid?).to be true
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
context 'when is not equal to config placeholder line' do
|
35
|
-
subject { Danger::Changelog::ChangelogPlaceholderLine.new("* Your change here.\n") }
|
36
|
-
|
37
|
-
it 'is not valid' do
|
38
|
-
expect(subject.valid?).to be false
|
39
|
-
end
|
40
|
-
end
|
16
|
+
context 'when line is not equal to placeholder_line from config' do
|
17
|
+
it_behaves_like 'does not validate as changelog placeholder line', "* Put your contribution here.\n"
|
18
|
+
it_behaves_like 'invalid changelog placeholder line', "* Put your contribution here.\n"
|
41
19
|
end
|
42
20
|
end
|
43
21
|
|
@@ -48,22 +26,9 @@ describe Danger::Changelog::ChangelogPlaceholderLine do
|
|
48
26
|
end
|
49
27
|
end
|
50
28
|
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
expect(described_class.validates_as_changelog_line?("* Whatever.\n")).to be false
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
describe 'valid?' do
|
60
|
-
context 'when is not blank' do
|
61
|
-
subject { Danger::Changelog::ChangelogPlaceholderLine.new("* Your change here.\n") }
|
62
|
-
|
63
|
-
it 'is not valid' do
|
64
|
-
expect(subject.valid?).to be false
|
65
|
-
end
|
66
|
-
end
|
29
|
+
context 'when line is not blank' do
|
30
|
+
it_behaves_like 'does not validate as changelog placeholder line', "* Whatever.\n"
|
31
|
+
it_behaves_like 'invalid changelog placeholder line', "* Whatever.\n"
|
67
32
|
end
|
68
33
|
end
|
69
34
|
end
|
@@ -1,8 +1,3 @@
|
|
1
|
-
## Changelog
|
2
|
-
|
3
|
-
### Changed:
|
4
|
-
### Fixed:
|
5
|
-
|
6
1
|
### 0.0.0
|
7
2
|
### 0.0.1
|
8
3
|
### 1.2.3 (2018/1/1)
|
@@ -13,7 +8,6 @@
|
|
13
8
|
### 0.0.4
|
14
9
|
### 10.2.3-DEV-SNAPSHOT
|
15
10
|
### 99999999999999999999999.999999999999999999.99999999999999999
|
16
|
-
|
17
11
|
### 0.1.1 [2018/1/1]
|
18
12
|
### [0.1.1] [2018/1/1]
|
19
13
|
## [0.2.2] - 2017-06-20
|
data/spec/spec_helper.rb
CHANGED
@@ -39,3 +39,9 @@ def testing_dangerfile
|
|
39
39
|
env = Danger::EnvironmentManager.new(testing_env)
|
40
40
|
Danger::Dangerfile.new(env, testing_ui)
|
41
41
|
end
|
42
|
+
|
43
|
+
require 'active_support'
|
44
|
+
|
45
|
+
Dir[File.join(File.dirname(__FILE__), 'support', '**/*.rb')].each do |file|
|
46
|
+
require file
|
47
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
[
|
2
|
+
Danger::Changelog::ChangelogHeaderLine,
|
3
|
+
Danger::Changelog::ChangelogPlaceholderLine,
|
4
|
+
Danger::Changelog::ChangelogEntryLine
|
5
|
+
].each do |klass|
|
6
|
+
desc = ActiveSupport::Inflector.titleize(klass.name.split(':').last).downcase
|
7
|
+
|
8
|
+
RSpec.shared_examples "validates as #{desc}" do |line|
|
9
|
+
describe line do
|
10
|
+
it 'correctly' do
|
11
|
+
expect(klass.validates_as_changelog_line?(line)).to be true
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
RSpec.shared_examples "does not validate as #{desc}" do |line|
|
17
|
+
describe line do
|
18
|
+
it 'correctly' do
|
19
|
+
expect(klass.validates_as_changelog_line?(line)).to be false
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
RSpec.shared_examples "valid #{desc}" do |line|
|
25
|
+
describe line do
|
26
|
+
subject { klass.new(line) }
|
27
|
+
it 'is valid' do
|
28
|
+
expect(subject.valid?).to be true
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
RSpec.shared_examples "invalid #{desc}" do |line|
|
34
|
+
describe line do
|
35
|
+
subject { klass.new(line) }
|
36
|
+
it 'is valid' do
|
37
|
+
expect(subject.valid?).to be false
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: danger-changelog
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- dblock
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-12-
|
11
|
+
date: 2018-12-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: danger-plugin-api
|
@@ -24,6 +24,20 @@ dependencies:
|
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: activesupport
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: bundler
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -200,6 +214,7 @@ files:
|
|
200
214
|
- spec/fixtures/changelogs/missing_your_contribution_here.md
|
201
215
|
- spec/fixtures/changelogs/semver.md
|
202
216
|
- spec/spec_helper.rb
|
217
|
+
- spec/support/shared/changelog.rb
|
203
218
|
homepage: https://github.com/dblock/danger-changelog
|
204
219
|
licenses:
|
205
220
|
- MIT
|
@@ -240,3 +255,4 @@ test_files:
|
|
240
255
|
- spec/fixtures/changelogs/missing_your_contribution_here.md
|
241
256
|
- spec/fixtures/changelogs/semver.md
|
242
257
|
- spec/spec_helper.rb
|
258
|
+
- spec/support/shared/changelog.rb
|