github_changelog_generator 1.14.3 → 1.15.0.pre.alpha
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +27 -22
- data/Rakefile +6 -26
- data/bin/ghclgen +1 -0
- data/lib/github_changelog_generator.rb +10 -13
- data/lib/github_changelog_generator/generator/generator.rb +19 -8
- data/lib/github_changelog_generator/generator/generator_fetcher.rb +2 -1
- data/lib/github_changelog_generator/generator/generator_generation.rb +11 -8
- data/lib/github_changelog_generator/generator/generator_processor.rb +7 -8
- data/lib/github_changelog_generator/generator/generator_tags.rb +41 -41
- data/lib/github_changelog_generator/helper.rb +1 -0
- data/lib/github_changelog_generator/octo_fetcher.rb +25 -4
- data/lib/github_changelog_generator/options.rb +50 -57
- data/lib/github_changelog_generator/parser.rb +16 -15
- data/lib/github_changelog_generator/parser_file.rb +4 -3
- data/lib/github_changelog_generator/reader.rb +1 -0
- data/lib/github_changelog_generator/ssl_certs/cacert.pem +4043 -0
- data/lib/github_changelog_generator/task.rb +3 -2
- data/lib/github_changelog_generator/version.rb +2 -1
- data/man/git-generate-changelog.1 +3 -3
- data/man/git-generate-changelog.1.html +3 -7
- data/man/git-generate-changelog.html +0 -4
- data/man/git-generate-changelog.md +6 -6
- data/spec/spec_helper.rb +2 -3
- data/spec/unit/generator/generator_generation_spec.rb +17 -0
- data/spec/unit/generator/generator_processor_spec.rb +64 -13
- data/spec/unit/generator/generator_tags_spec.rb +123 -65
- data/spec/unit/octo_fetcher_spec.rb +17 -2
- data/spec/unit/options_spec.rb +1 -0
- data/spec/unit/parse_file_spec.rb +6 -6
- data/spec/unit/parser_spec.rb +1 -0
- data/spec/unit/reader_spec.rb +1 -0
- data/spec/vcr/GitHubChangelogGenerator_OctoFetcher/_commits_before/when_API_is_valid/returns_commits.json +1 -0
- metadata +14 -9
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
require "rake"
|
3
4
|
require "rake/tasklib"
|
4
5
|
require "github_changelog_generator"
|
@@ -7,7 +8,7 @@ module GitHubChangelogGenerator
|
|
7
8
|
class RakeTask < ::Rake::TaskLib
|
8
9
|
include ::Rake::DSL if defined?(::Rake::DSL)
|
9
10
|
|
10
|
-
OPTIONS = %w
|
11
|
+
OPTIONS = %w[ user project token date_format output
|
11
12
|
bug_prefix enhancement_prefix issue_prefix
|
12
13
|
header merge_prefix issues
|
13
14
|
add_issues_wo_labels add_pr_wo_labels
|
@@ -18,7 +19,7 @@ module GitHubChangelogGenerator
|
|
18
19
|
between_tags exclude_tags exclude_tags_regex since_tag max_issues
|
19
20
|
github_site github_endpoint simple_list
|
20
21
|
future_release release_branch verbose release_url
|
21
|
-
base
|
22
|
+
base ]
|
22
23
|
|
23
24
|
OPTIONS.each do |o|
|
24
25
|
attr_accessor o.to_sym
|
@@ -1,7 +1,7 @@
|
|
1
1
|
.\" generated with Ronn/v0.7.3
|
2
2
|
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
3
3
|
.
|
4
|
-
.TH "GIT\-GENERATE\-CHANGELOG" "1" "
|
4
|
+
.TH "GIT\-GENERATE\-CHANGELOG" "1" "December 2016" "" ""
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBgit\-generate\-changelog\fR \- Generate changelog from github
|
@@ -256,13 +256,13 @@ Use HTTP Cache to cache Github API requests (useful for large repos) Default is
|
|
256
256
|
\-\-[no\-]cache\-file [CACHE\-FILE]
|
257
257
|
.
|
258
258
|
.P
|
259
|
-
Filename to use for cache\. Default is
|
259
|
+
Filename to use for cache\. Default is github\-changelog\-http\-cache in a temporary directory\.
|
260
260
|
.
|
261
261
|
.P
|
262
262
|
\-\-cache\-log [CACHE\-LOG]
|
263
263
|
.
|
264
264
|
.P
|
265
|
-
Filename to use for cache log\. Default is
|
265
|
+
Filename to use for cache log\. Default is github\-changelog\-logger\.log in a temporary directory\.
|
266
266
|
.
|
267
267
|
.P
|
268
268
|
\-\-[no\-]verbose
|
@@ -192,10 +192,6 @@
|
|
192
192
|
|
193
193
|
<p> Issues with the specified labels will be always added to "Implemented enhancements" section. Default is 'enhancement,Enhancement'</p>
|
194
194
|
|
195
|
-
<p> --between-tags x,y,z</p>
|
196
|
-
|
197
|
-
<p> Change log will be filled only between specified tags</p>
|
198
|
-
|
199
195
|
<p> --exclude-tags x,y,z</p>
|
200
196
|
|
201
197
|
<p> Change log will exclude specified tags</p>
|
@@ -246,11 +242,11 @@
|
|
246
242
|
|
247
243
|
<p> --[no-]cache-file [CACHE-FILE]</p>
|
248
244
|
|
249
|
-
<p> Filename to use for cache. Default is
|
245
|
+
<p> Filename to use for cache. Default is github-changelog-http-cache in a temporary directory.</p>
|
250
246
|
|
251
247
|
<p> --cache-log [CACHE-LOG]</p>
|
252
248
|
|
253
|
-
<p> Filename to use for cache log. Default is
|
249
|
+
<p> Filename to use for cache log. Default is github-changelog-logger.log in a temporary directory.</p>
|
254
250
|
|
255
251
|
<p> --[no-]verbose</p>
|
256
252
|
|
@@ -281,7 +277,7 @@
|
|
281
277
|
|
282
278
|
<ol class='man-decor man-foot man foot'>
|
283
279
|
<li class='tl'></li>
|
284
|
-
<li class='tc'>
|
280
|
+
<li class='tc'>December 2016</li>
|
285
281
|
<li class='tr'>git-generate-changelog(1)</li>
|
286
282
|
</ol>
|
287
283
|
|
@@ -184,10 +184,6 @@
|
|
184
184
|
|
185
185
|
<p> Issues with the specified labels will be always added to "Implemented enhancements" section. Default is 'enhancement,Enhancement'</p>
|
186
186
|
|
187
|
-
<p> --between-tags x,y,z</p>
|
188
|
-
|
189
|
-
<p> Change log will be filled only between specified tags</p>
|
190
|
-
|
191
187
|
<p> --exclude-tags x,y,z</p>
|
192
188
|
|
193
189
|
<p> Change log will exclude specified tags</p>
|
@@ -119,10 +119,6 @@ Automatically generate change log from your tags, issues, labels and pull reques
|
|
119
119
|
|
120
120
|
Issues with the specified labels will be always added to "Implemented enhancements" section. Default is 'enhancement,Enhancement'
|
121
121
|
|
122
|
-
--between-tags x,y,z
|
123
|
-
|
124
|
-
Change log will be filled only between specified tags
|
125
|
-
|
126
122
|
--exclude-tags x,y,z
|
127
123
|
|
128
124
|
Change log will exclude specified tags
|
@@ -173,11 +169,15 @@ Automatically generate change log from your tags, issues, labels and pull reques
|
|
173
169
|
|
174
170
|
--[no-]cache-file [CACHE-FILE]
|
175
171
|
|
176
|
-
Filename to use for cache. Default is
|
172
|
+
Filename to use for cache. Default is github-changelog-http-cache in a temporary directory.
|
177
173
|
|
178
174
|
--cache-log [CACHE-LOG]
|
179
175
|
|
180
|
-
Filename to use for cache log. Default is
|
176
|
+
Filename to use for cache log. Default is github-changelog-logger.log in a temporary directory.
|
177
|
+
|
178
|
+
--ssl-ca-file [PATH]
|
179
|
+
|
180
|
+
Path to cacert.pem file. Default is a bundled lib/github_changelog_generator/ssl_certs/cacert.pem. Respects SSL_CA_PATH.
|
181
181
|
|
182
182
|
--[no-]verbose
|
183
183
|
|
data/spec/spec_helper.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
#
|
3
4
|
# Author:: Enrico Stahn <mail@enricostahn.com>
|
4
5
|
#
|
@@ -16,7 +17,6 @@
|
|
16
17
|
# See the License for the specific language governing permissions and
|
17
18
|
# limitations under the License.
|
18
19
|
#
|
19
|
-
require "codeclimate-test-reporter"
|
20
20
|
require "simplecov"
|
21
21
|
require "coveralls"
|
22
22
|
require "vcr"
|
@@ -28,8 +28,7 @@ end
|
|
28
28
|
|
29
29
|
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new([
|
30
30
|
Coveralls::SimpleCov::Formatter,
|
31
|
-
SimpleCov::Formatter::HTMLFormatter
|
32
|
-
CodeClimate::TestReporter::Formatter
|
31
|
+
SimpleCov::Formatter::HTMLFormatter
|
33
32
|
])
|
34
33
|
SimpleCov.start do
|
35
34
|
add_filter "gemfiles/"
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module GitHubChangelogGenerator
|
4
|
+
describe Generator do
|
5
|
+
describe "#get_string_for_issue" do
|
6
|
+
let(:issue) do
|
7
|
+
{ "title" => "Bug in code" }
|
8
|
+
end
|
9
|
+
|
10
|
+
it "formats an issue according to options" do
|
11
|
+
expect do
|
12
|
+
described_class.new.get_string_for_issue(issue)
|
13
|
+
end.not_to raise_error
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -1,19 +1,32 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
module GitHubChangelogGenerator
|
3
4
|
describe Generator do
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
5
|
+
let(:default_options) { GitHubChangelogGenerator::Parser.default_options }
|
6
|
+
let(:options) { {} }
|
7
|
+
let(:generator) { described_class.new(default_options.merge(options)) }
|
8
|
+
|
9
|
+
let(:bad_label) { { "name" => "BAD" } }
|
10
|
+
let(:bad_issue) { { "labels" => [bad_label] } }
|
11
|
+
let(:good_label) { { "name" => "GOOD" } }
|
12
|
+
let(:good_issue) { { "labels" => [good_label] } }
|
13
|
+
let(:unlabeled_issue) { { "labels" => [] } }
|
14
|
+
let(:issues) { [bad_issue, good_issue, unlabeled_issue] }
|
15
|
+
|
16
|
+
describe "#exclude_issues_by_labels" do
|
17
|
+
subject do
|
18
|
+
generator.exclude_issues_by_labels(issues)
|
19
|
+
end
|
20
|
+
|
21
|
+
let(:expected_issues) { issues }
|
22
|
+
|
23
|
+
it { is_expected.to eq(expected_issues) }
|
24
|
+
|
25
|
+
context "when 'exclude_lables' is provided" do
|
26
|
+
let(:options) { { exclude_labels: %w[BAD BOO] } }
|
27
|
+
let(:expected_issues) { [good_issue, unlabeled_issue] }
|
28
|
+
|
29
|
+
it { is_expected.to eq(expected_issues) }
|
17
30
|
end
|
18
31
|
|
19
32
|
context "with no option given" do
|
@@ -25,5 +38,43 @@ module GitHubChangelogGenerator
|
|
25
38
|
end
|
26
39
|
end
|
27
40
|
end
|
41
|
+
|
42
|
+
describe "#get_filtered_issues" do
|
43
|
+
subject do
|
44
|
+
generator.get_filtered_issues(issues)
|
45
|
+
end
|
46
|
+
|
47
|
+
let(:expected_issues) { issues }
|
48
|
+
|
49
|
+
it { is_expected.to eq(expected_issues) }
|
50
|
+
|
51
|
+
context "when 'exclude_labels' is provided" do
|
52
|
+
let(:options) { { exclude_labels: %w[BAD BOO] } }
|
53
|
+
let(:expected_issues) { [good_issue, unlabeled_issue] }
|
54
|
+
|
55
|
+
it { is_expected.to eq(expected_issues) }
|
56
|
+
end
|
57
|
+
|
58
|
+
context "when 'add_issues_wo_labels' is false" do
|
59
|
+
let(:options) { { add_issues_wo_labels: false } }
|
60
|
+
let(:expected_issues) { [bad_issue, good_issue] }
|
61
|
+
|
62
|
+
it { is_expected.to eq(expected_issues) }
|
63
|
+
|
64
|
+
context "with 'exclude_labels'" do
|
65
|
+
let(:options) { { add_issues_wo_labels: false, exclude_labels: %w[GOOD] } }
|
66
|
+
let(:expected_issues) { [bad_issue] }
|
67
|
+
|
68
|
+
it { is_expected.to eq(expected_issues) }
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
context "when 'include_labels' is specified" do
|
73
|
+
let(:options) { { include_labels: %w[GOOD] } }
|
74
|
+
let(:expected_issues) { [good_issue] }
|
75
|
+
|
76
|
+
it { is_expected.to eq(expected_issues) }
|
77
|
+
end
|
78
|
+
end
|
28
79
|
end
|
29
80
|
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
describe GitHubChangelogGenerator::Generator do
|
3
4
|
def tag_with_name(tag)
|
4
5
|
{
|
@@ -12,174 +13,231 @@ describe GitHubChangelogGenerator::Generator do
|
|
12
13
|
end
|
13
14
|
end
|
14
15
|
|
15
|
-
describe "#
|
16
|
-
|
17
|
-
|
18
|
-
@generator = GitHubChangelogGenerator::Generator.new(between_tags: nil)
|
19
|
-
end
|
16
|
+
describe "#tag_section_mapping" do
|
17
|
+
let(:all_tags) { tags_from_strings(%w[8 7 6 5 4 3 2 1]) }
|
18
|
+
let(:sorted_tags) { all_tags }
|
20
19
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
20
|
+
let(:default_options) { GitHubChangelogGenerator::Parser.default_options }
|
21
|
+
let(:options) { {} }
|
22
|
+
let(:generator) { described_class.new(default_options.merge(options)) }
|
23
|
+
|
24
|
+
before do
|
25
|
+
allow_any_instance_of(GitHubChangelogGenerator::OctoFetcher).to receive(:get_all_tags).and_return(all_tags)
|
26
|
+
allow(generator).to receive(:fetch_tags_dates).with(all_tags)
|
27
|
+
allow(generator).to receive(:sort_tags_by_date).with(all_tags).and_return(sorted_tags)
|
28
|
+
generator.fetch_and_filter_tags
|
26
29
|
end
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
end
|
31
|
-
subject do
|
32
|
-
@generator.get_filtered_tags(tags_from_strings(%w(1 2 3)))
|
33
|
-
end
|
34
|
-
it { is_expected.to be_a(Array) }
|
35
|
-
it { is_expected.to match_array(tags_from_strings(%w(1 2 3))) }
|
30
|
+
|
31
|
+
subject do
|
32
|
+
generator.tag_section_mapping
|
36
33
|
end
|
37
34
|
|
38
|
-
|
39
|
-
|
40
|
-
|
35
|
+
shared_examples_for "a section mapping" do
|
36
|
+
it { is_expected.to be_a(Hash) }
|
37
|
+
it { is_expected.to eq(expected_mapping) }
|
38
|
+
end
|
39
|
+
|
40
|
+
shared_examples_for "a full changelog" do
|
41
|
+
let(:expected_mapping) do
|
42
|
+
{
|
43
|
+
tag_with_name("8") => [tag_with_name("7"), tag_with_name("8")],
|
44
|
+
tag_with_name("7") => [tag_with_name("6"), tag_with_name("7")],
|
45
|
+
tag_with_name("6") => [tag_with_name("5"), tag_with_name("6")],
|
46
|
+
tag_with_name("5") => [tag_with_name("4"), tag_with_name("5")],
|
47
|
+
tag_with_name("4") => [tag_with_name("3"), tag_with_name("4")],
|
48
|
+
tag_with_name("3") => [tag_with_name("2"), tag_with_name("3")],
|
49
|
+
tag_with_name("2") => [tag_with_name("1"), tag_with_name("2")],
|
50
|
+
tag_with_name("1") => [nil, tag_with_name("1")]
|
51
|
+
}
|
41
52
|
end
|
42
|
-
|
43
|
-
|
53
|
+
|
54
|
+
it_behaves_like "a section mapping"
|
55
|
+
end
|
56
|
+
|
57
|
+
shared_examples_for "a changelog with some exclusions" do
|
58
|
+
let(:expected_mapping) do
|
59
|
+
{
|
60
|
+
tag_with_name("8") => [tag_with_name("7"), tag_with_name("8")],
|
61
|
+
tag_with_name("6") => [tag_with_name("5"), tag_with_name("6")],
|
62
|
+
tag_with_name("4") => [tag_with_name("3"), tag_with_name("4")],
|
63
|
+
tag_with_name("3") => [tag_with_name("2"), tag_with_name("3")],
|
64
|
+
tag_with_name("1") => [nil, tag_with_name("1")]
|
65
|
+
}
|
44
66
|
end
|
45
|
-
|
46
|
-
|
67
|
+
|
68
|
+
it_behaves_like "a section mapping"
|
47
69
|
end
|
48
70
|
|
49
|
-
context "
|
50
|
-
|
51
|
-
|
71
|
+
context "with no constraints" do
|
72
|
+
it_behaves_like "a full changelog"
|
73
|
+
end
|
74
|
+
|
75
|
+
context "with since only" do
|
76
|
+
let(:options) { { since_tag: "6" } }
|
77
|
+
let(:expected_mapping) do
|
78
|
+
{
|
79
|
+
tag_with_name("8") => [tag_with_name("7"), tag_with_name("8")],
|
80
|
+
tag_with_name("7") => [tag_with_name("6"), tag_with_name("7")]
|
81
|
+
}
|
52
82
|
end
|
53
83
|
|
54
|
-
|
55
|
-
|
84
|
+
it_behaves_like "a section mapping"
|
85
|
+
end
|
86
|
+
|
87
|
+
context "with due only" do
|
88
|
+
let(:options) { { due_tag: "4" } }
|
89
|
+
let(:expected_mapping) do
|
90
|
+
{
|
91
|
+
tag_with_name("3") => [tag_with_name("2"), tag_with_name("3")],
|
92
|
+
tag_with_name("2") => [tag_with_name("1"), tag_with_name("2")],
|
93
|
+
tag_with_name("1") => [nil, tag_with_name("1")]
|
94
|
+
}
|
56
95
|
end
|
57
|
-
|
58
|
-
|
96
|
+
|
97
|
+
it_behaves_like "a section mapping"
|
59
98
|
end
|
60
|
-
end
|
61
99
|
|
62
|
-
|
63
|
-
|
64
|
-
|
100
|
+
context "with since and due" do
|
101
|
+
let(:options) { { since_tag: "2", due_tag: "5" } }
|
102
|
+
let(:expected_mapping) do
|
103
|
+
{
|
104
|
+
tag_with_name("4") => [tag_with_name("3"), tag_with_name("4")],
|
105
|
+
tag_with_name("3") => [tag_with_name("2"), tag_with_name("3")]
|
106
|
+
}
|
107
|
+
end
|
108
|
+
|
109
|
+
it_behaves_like "a section mapping"
|
65
110
|
end
|
66
111
|
|
67
|
-
context "
|
68
|
-
|
112
|
+
context "with excluded tags" do
|
113
|
+
context "as a list of strings" do
|
114
|
+
let(:options) { { exclude_tags: %w[2 5 7] } }
|
69
115
|
|
70
|
-
|
71
|
-
|
116
|
+
it_behaves_like "a changelog with some exclusions"
|
117
|
+
end
|
118
|
+
|
119
|
+
context "as a regex" do
|
120
|
+
let(:options) { { exclude_tags: /[257]/ } }
|
121
|
+
|
122
|
+
it_behaves_like "a changelog with some exclusions"
|
123
|
+
end
|
124
|
+
|
125
|
+
context "as a regex string" do
|
126
|
+
let(:options) { { exclude_tags_regex: "[257]" } }
|
127
|
+
|
128
|
+
it_behaves_like "a changelog with some exclusions"
|
129
|
+
end
|
72
130
|
end
|
73
131
|
end
|
74
132
|
|
75
133
|
describe "#filter_excluded_tags" do
|
76
|
-
subject { generator.filter_excluded_tags(tags_from_strings(%w
|
134
|
+
subject { generator.filter_excluded_tags(tags_from_strings(%w[1 2 3])) }
|
77
135
|
|
78
136
|
context "with matching string" do
|
79
|
-
let(:generator) { GitHubChangelogGenerator::Generator.new(exclude_tags: %w
|
137
|
+
let(:generator) { GitHubChangelogGenerator::Generator.new(exclude_tags: %w[3]) }
|
80
138
|
it { is_expected.to be_a Array }
|
81
|
-
it { is_expected.to match_array(tags_from_strings(%w
|
139
|
+
it { is_expected.to match_array(tags_from_strings(%w[1 2])) }
|
82
140
|
end
|
83
141
|
|
84
142
|
context "with non-matching string" do
|
85
|
-
let(:generator) { GitHubChangelogGenerator::Generator.new(exclude_tags: %w
|
143
|
+
let(:generator) { GitHubChangelogGenerator::Generator.new(exclude_tags: %w[invalid tags]) }
|
86
144
|
it { is_expected.to be_a Array }
|
87
|
-
it { is_expected.to match_array(tags_from_strings(%w
|
145
|
+
it { is_expected.to match_array(tags_from_strings(%w[1 2 3])) }
|
88
146
|
end
|
89
147
|
|
90
148
|
context "with matching regex" do
|
91
149
|
let(:generator) { GitHubChangelogGenerator::Generator.new(exclude_tags: /[23]/) }
|
92
150
|
it { is_expected.to be_a Array }
|
93
|
-
it { is_expected.to match_array(tags_from_strings(%w
|
151
|
+
it { is_expected.to match_array(tags_from_strings(%w[1])) }
|
94
152
|
end
|
95
153
|
|
96
154
|
context "with non-matching regex" do
|
97
155
|
let(:generator) { GitHubChangelogGenerator::Generator.new(exclude_tags: /[abc]/) }
|
98
156
|
it { is_expected.to be_a Array }
|
99
|
-
it { is_expected.to match_array(tags_from_strings(%w
|
157
|
+
it { is_expected.to match_array(tags_from_strings(%w[1 2 3])) }
|
100
158
|
end
|
101
159
|
end
|
102
160
|
|
103
161
|
describe "#filter_excluded_tags_regex" do
|
104
|
-
subject { generator.filter_excluded_tags(tags_from_strings(%w
|
162
|
+
subject { generator.filter_excluded_tags(tags_from_strings(%w[1 2 3])) }
|
105
163
|
|
106
164
|
context "with matching regex" do
|
107
165
|
let(:generator) { GitHubChangelogGenerator::Generator.new(exclude_tags_regex: "[23]") }
|
108
166
|
it { is_expected.to be_a Array }
|
109
|
-
it { is_expected.to match_array(tags_from_strings(%w
|
167
|
+
it { is_expected.to match_array(tags_from_strings(%w[1])) }
|
110
168
|
end
|
111
169
|
|
112
170
|
context "with non-matching regex" do
|
113
171
|
let(:generator) { GitHubChangelogGenerator::Generator.new(exclude_tags_regex: "[45]") }
|
114
172
|
it { is_expected.to be_a Array }
|
115
|
-
it { is_expected.to match_array(tags_from_strings(%w
|
173
|
+
it { is_expected.to match_array(tags_from_strings(%w[1 2 3])) }
|
116
174
|
end
|
117
175
|
end
|
118
176
|
|
119
177
|
describe "#filter_since_tag" do
|
120
178
|
context "with filled array" do
|
121
|
-
subject { generator.filter_since_tag(tags_from_strings(%w
|
179
|
+
subject { generator.filter_since_tag(tags_from_strings(%w[1 2 3])) }
|
122
180
|
|
123
181
|
context "with valid since tag" do
|
124
182
|
let(:generator) { GitHubChangelogGenerator::Generator.new(since_tag: "2") }
|
125
183
|
it { is_expected.to be_a Array }
|
126
|
-
it { is_expected.to match_array(tags_from_strings(%w
|
184
|
+
it { is_expected.to match_array(tags_from_strings(%w[1 2])) }
|
127
185
|
end
|
128
186
|
|
129
187
|
context "with invalid since tag" do
|
130
188
|
let(:generator) { GitHubChangelogGenerator::Generator.new(since_tag: "Invalid tag") }
|
131
189
|
it { is_expected.to be_a Array }
|
132
|
-
it { is_expected.to match_array(tags_from_strings(%w
|
190
|
+
it { is_expected.to match_array(tags_from_strings(%w[1 2 3])) }
|
133
191
|
end
|
134
192
|
end
|
135
193
|
|
136
194
|
context "with empty array" do
|
137
|
-
subject { generator.filter_since_tag(tags_from_strings(%w
|
195
|
+
subject { generator.filter_since_tag(tags_from_strings(%w[])) }
|
138
196
|
|
139
197
|
context "with valid since tag" do
|
140
198
|
let(:generator) { GitHubChangelogGenerator::Generator.new(since_tag: "2") }
|
141
199
|
it { is_expected.to be_a Array }
|
142
|
-
it { is_expected.to match_array(tags_from_strings(%w
|
200
|
+
it { is_expected.to match_array(tags_from_strings(%w[])) }
|
143
201
|
end
|
144
202
|
|
145
203
|
context "with invalid since tag" do
|
146
204
|
let(:generator) { GitHubChangelogGenerator::Generator.new(since_tag: "Invalid tag") }
|
147
205
|
it { is_expected.to be_a Array }
|
148
|
-
it { is_expected.to match_array(tags_from_strings(%w
|
206
|
+
it { is_expected.to match_array(tags_from_strings(%w[])) }
|
149
207
|
end
|
150
208
|
end
|
151
209
|
end
|
152
210
|
|
153
211
|
describe "#filter_due_tag" do
|
154
212
|
context "with filled array" do
|
155
|
-
subject { generator.filter_due_tag(tags_from_strings(%w
|
213
|
+
subject { generator.filter_due_tag(tags_from_strings(%w[1 2 3])) }
|
156
214
|
|
157
215
|
context "with valid due tag" do
|
158
216
|
let(:generator) { GitHubChangelogGenerator::Generator.new(due_tag: "2") }
|
159
217
|
it { is_expected.to be_a Array }
|
160
|
-
it { is_expected.to match_array(tags_from_strings(%w
|
218
|
+
it { is_expected.to match_array(tags_from_strings(%w[3])) }
|
161
219
|
end
|
162
220
|
|
163
221
|
context "with invalid due tag" do
|
164
222
|
let(:generator) { GitHubChangelogGenerator::Generator.new(due_tag: "Invalid tag") }
|
165
223
|
it { is_expected.to be_a Array }
|
166
|
-
it { is_expected.to match_array(tags_from_strings(%w
|
224
|
+
it { is_expected.to match_array(tags_from_strings(%w[1 2 3])) }
|
167
225
|
end
|
168
226
|
end
|
169
227
|
|
170
228
|
context "with empty array" do
|
171
|
-
subject { generator.filter_due_tag(tags_from_strings(%w
|
229
|
+
subject { generator.filter_due_tag(tags_from_strings(%w[])) }
|
172
230
|
|
173
231
|
context "with valid due tag" do
|
174
232
|
let(:generator) { GitHubChangelogGenerator::Generator.new(due_tag: "2") }
|
175
233
|
it { is_expected.to be_a Array }
|
176
|
-
it { is_expected.to match_array(tags_from_strings(%w
|
234
|
+
it { is_expected.to match_array(tags_from_strings(%w[])) }
|
177
235
|
end
|
178
236
|
|
179
237
|
context "with invalid due tag" do
|
180
238
|
let(:generator) { GitHubChangelogGenerator::Generator.new(due_tag: "Invalid tag") }
|
181
239
|
it { is_expected.to be_a Array }
|
182
|
-
it { is_expected.to match_array(tags_from_strings(%w
|
240
|
+
it { is_expected.to match_array(tags_from_strings(%w[])) }
|
183
241
|
end
|
184
242
|
end
|
185
243
|
end
|
@@ -232,13 +290,13 @@ describe GitHubChangelogGenerator::Generator do
|
|
232
290
|
@generator.sort_tags_by_date(tags)
|
233
291
|
end
|
234
292
|
context "sort unsorted tags" do
|
235
|
-
let(:tags) { tags_from_strings %w
|
293
|
+
let(:tags) { tags_from_strings %w[valid_tag1 valid_tag2 valid_tag3] }
|
236
294
|
|
237
295
|
it { is_expected.to be_a_kind_of(Array) }
|
238
296
|
it { is_expected.to match_array(tags.reverse!) }
|
239
297
|
end
|
240
298
|
context "sort sorted tags" do
|
241
|
-
let(:tags) { tags_from_strings %w
|
299
|
+
let(:tags) { tags_from_strings %w[valid_tag3 valid_tag2 valid_tag1] }
|
242
300
|
|
243
301
|
it { is_expected.to be_a_kind_of(Array) }
|
244
302
|
it { is_expected.to match_array(tags) }
|