renogen 1.3.0 → 1.3.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0d53b818e9ebb6f258fd39cfbe9c83acd9e9818fb49a288c11c86afe38e0f387
4
- data.tar.gz: 1960bf0af875ef179e1f34826caf9ef56e7dec676c5bd7db44f9c05151448e53
3
+ metadata.gz: 3f61827e5a1a1224d86a20cddecf5757ace8719f2c6e38120e859f8951289814
4
+ data.tar.gz: f1174f4d416402cbf025a5a05f3f2f5ca00c436cecc032c6b87399dac7422bed
5
5
  SHA512:
6
- metadata.gz: 579845fd96294be9ef4a70ac58f7c9b6097951b8343013a7fa98f1ffc7ef42758ffa8ce7bd7b3adfb5eea23530f237032c792e887d0296f7a72e98fac2dc1203
7
- data.tar.gz: aaa2da2cdaaa0c7ac48e3d7f8dcfbbdc82230d643c6d660a4d8453c5d8aa5eb03e84546afd7e1f154440dadabf588b14e9c9d17f1fff651f1a41cf2a047c78bf
6
+ metadata.gz: 6683b5861e4d779967bf100a6683be6c6dccfe64e099906f6991caa266e5a976601c96a9905d8e89d91d2a958190301b3d7c54f79e7a644ff27319f8f50da926
7
+ data.tar.gz: aebbc3dcdf470a7882cf2c038406085d9233774f828675a7b5c0e787899c5be6ccb297419c9a82d92e9e64d172a73dcc71f2a6258aedf893c9dd8e16adbbec3e
@@ -22,6 +22,7 @@ module Renogen
22
22
  next if raw_line.nil?
23
23
 
24
24
  parsed_line = raw_line.is_a?(Array) ? raw_line.join(',') : raw_line
25
+ parsed_line = parsed_line.chomp
25
26
  parsed_line.gsub!("\n", '\n') if parsed_line.include?("\n")
26
27
 
27
28
  if parsed_line.include?(',')
@@ -22,7 +22,7 @@ module Renogen
22
22
  "# #{changelog.version} (#{changelog.date})",
23
23
  "",
24
24
  "| #{headings.join(' | ')} |",
25
- "| #{headings.map{|_| ' - |' }.join()}"
25
+ "| #{headings.map{|_| '-' }.join(' | ')} |"
26
26
  ].join("\n")
27
27
  end
28
28
 
@@ -1,3 +1,3 @@
1
1
  module Renogen
2
- VERSION = '1.3.0'.freeze # :nodoc:
2
+ VERSION = '1.3.1'.freeze # :nodoc:
3
3
  end
@@ -0,0 +1,147 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ describe Renogen::ChangeLog::Writer do
6
+ describe '#write!' do
7
+ shared_examples 'a valid output format' do
8
+ let(:changelog) do
9
+ Renogen::ChangeLog::Model.new(
10
+ version: 'test',
11
+ date: Date.new(2020, 7, 8)
12
+ )
13
+ end
14
+
15
+ let(:changes) do
16
+ [
17
+ renogen_change(1, 'Group 1', 'This is a Group 1 change'),
18
+ renogen_change(1, 'Group 2', 'This is a Group 2 change')
19
+ ]
20
+ end
21
+
22
+ subject { Renogen::ChangeLog::Writer.new(formatter) }
23
+
24
+ before do
25
+ changes.each { |c| changelog.add_change(c) }
26
+ $stdout = StringIO.new
27
+ end
28
+
29
+ after do
30
+ $stdout = STDOUT
31
+ end
32
+
33
+ it 'writes all lines' do
34
+ subject.write!(changelog)
35
+ $stdout.rewind
36
+ expected_output.split("\n").each do |line|
37
+ expect($stdout.gets.strip).to eq(line)
38
+ end
39
+ end
40
+ end
41
+
42
+ context 'when formatter is CSV' do
43
+ let(:formatter) { Renogen::Formatters::Csv.new }
44
+ let(:expected_output) do
45
+ <<~EOS
46
+ Group 1,Group 2
47
+ This is a Group 1 change,This is a Group 2 change
48
+ EOS
49
+ end
50
+
51
+ it_behaves_like 'a valid output format'
52
+
53
+ context 'when changes contain commas' do
54
+ it_behaves_like 'a valid output format' do
55
+ let(:changes) do
56
+ [
57
+ renogen_change(1, 'Group 1', 'This,is,a,Group 1,change'),
58
+ renogen_change(1, 'Group 2', 'This is a Group 2 change')
59
+ ]
60
+ end
61
+
62
+ let(:expected_output) do
63
+ <<~EOS
64
+ Group 1,Group 2
65
+ "This,is,a,Group 1,change",This is a Group 2 change
66
+ EOS
67
+ end
68
+ end
69
+ end
70
+ end
71
+
72
+ context 'when formatter is HTML' do
73
+ let(:formatter) { Renogen::Formatters::Html.new }
74
+ let(:expected_output) do
75
+ <<~EOS
76
+ <html>
77
+ <h1>test (2020-07-08)</h1>
78
+ <h2>Group 1</h2>
79
+ <ul>
80
+ <li>This is a Group 1 change
81
+ </li>
82
+ </ul>
83
+ <h2>Group 2</h2>
84
+ <ul>
85
+ <li>This is a Group 2 change
86
+ </li>
87
+ </ul>
88
+ </html>
89
+ EOS
90
+ end
91
+
92
+ it_behaves_like 'a valid output format'
93
+ end
94
+
95
+ context 'when formatter is Markdown' do
96
+ let(:formatter) { Renogen::Formatters::Markdown.new }
97
+ let(:expected_output) do
98
+ <<~EOS
99
+ # test (2020-07-08)
100
+
101
+ ## Group 1
102
+
103
+ * This is a Group 1 change
104
+
105
+ ## Group 2
106
+
107
+ * This is a Group 2 change
108
+ EOS
109
+ end
110
+
111
+ it_behaves_like 'a valid output format'
112
+ end
113
+
114
+ context 'when formatter is MarkdownTable' do
115
+ let(:formatter) { Renogen::Formatters::MarkdownTable.new }
116
+
117
+ let(:expected_output) do
118
+ <<~EOS
119
+ # test (2020-07-08)
120
+
121
+ | Group 1 | Group 2 |
122
+ | - | - |
123
+ | This is a Group 1 change<br> | This is a Group 2 change<br> |
124
+ EOS
125
+ end
126
+
127
+ it_behaves_like 'a valid output format'
128
+ end
129
+
130
+ context 'when formatter is PlainText' do
131
+ let(:formatter) { Renogen::Formatters::PlainText.new }
132
+ let(:expected_output) do
133
+ <<~EOS
134
+ test (2020-07-08)
135
+
136
+ Group 1
137
+ - This is a Group 1 change
138
+
139
+ Group 2
140
+ - This is a Group 2 change
141
+ EOS
142
+ end
143
+
144
+ it_behaves_like 'a valid output format'
145
+ end
146
+ end
147
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: renogen
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dave Elliott
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-07-09 00:00:00.000000000 Z
11
+ date: 2020-07-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -70,6 +70,7 @@ files:
70
70
  - spec/lib/renogen/change_log/item_spec.rb
71
71
  - spec/lib/renogen/change_log/model_spec.rb
72
72
  - spec/lib/renogen/change_log/validator_spec.rb
73
+ - spec/lib/renogen/change_log/writer_spec.rb
73
74
  - spec/lib/renogen/config_spec.rb
74
75
  - spec/lib/renogen/exceptions/invalid_item_found_spec.rb
75
76
  - spec/lib/renogen/exceptions/stratagy_not_found_spec.rb
@@ -91,7 +92,7 @@ homepage: https://github.com/DDAZZA/renogen
91
92
  licenses:
92
93
  - GPL-3.0
93
94
  metadata: {}
94
- post_install_message:
95
+ post_install_message:
95
96
  rdoc_options: []
96
97
  require_paths:
97
98
  - lib
@@ -106,9 +107,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
106
107
  - !ruby/object:Gem::Version
107
108
  version: '0'
108
109
  requirements: []
109
- rubyforge_project:
110
+ rubyforge_project:
110
111
  rubygems_version: 2.7.6.2
111
- signing_key:
112
+ signing_key:
112
113
  specification_version: 4
113
114
  summary: Release Notes/changelog Generator
114
115
  test_files: []