defmastership 1.0.3 → 1.0.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (60) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +2 -0
  3. data/.gitlab-ci.yml +0 -1
  4. data/.rubocop.yml +3 -2
  5. data/Gemfile +1 -0
  6. data/LICENSE +22 -0
  7. data/Rakefile +2 -2
  8. data/bin/defmastership +37 -24
  9. data/cucumber.yml +2 -0
  10. data/defmastership.gemspec +16 -9
  11. data/features/changeref.feature +82 -129
  12. data/features/definition_checksum.feature +244 -0
  13. data/features/definition_version.feature +24 -0
  14. data/features/export.feature +49 -31
  15. data/features/modify.feature +165 -0
  16. data/features/rename_included_files.feature +121 -0
  17. data/features/step_definitions/defmastership_steps.rb +1 -0
  18. data/features/support/env.rb +1 -0
  19. data/lib/defmastership.rb +15 -3
  20. data/lib/defmastership/batch_modifier.rb +35 -0
  21. data/lib/defmastership/{ref_changer.rb → change_ref_line_modifier.rb} +19 -35
  22. data/lib/defmastership/change_ref_modifier.rb +15 -0
  23. data/lib/defmastership/comment_filter.rb +1 -0
  24. data/lib/defmastership/constants.rb +15 -1
  25. data/lib/defmastership/csv_formatter.rb +26 -19
  26. data/lib/defmastership/csv_formatter_body.rb +20 -11
  27. data/lib/defmastership/csv_formatter_header.rb +16 -10
  28. data/lib/defmastership/definition.rb +15 -3
  29. data/lib/defmastership/definition_parser.rb +46 -0
  30. data/lib/defmastership/document.rb +60 -85
  31. data/lib/defmastership/filters.rb +30 -0
  32. data/lib/defmastership/line_modifier_base.rb +29 -0
  33. data/lib/defmastership/modifier_base.rb +29 -0
  34. data/lib/defmastership/rename_included_files_line_modifier.rb +126 -0
  35. data/lib/defmastership/rename_included_files_modifier.rb +15 -0
  36. data/lib/defmastership/update_def_checksum_line_modifier.rb +39 -0
  37. data/lib/defmastership/update_def_checksum_modifier.rb +21 -0
  38. data/lib/defmastership/version.rb +2 -1
  39. data/spec/spec_helper.rb +2 -0
  40. data/spec/unit/defmastership/batch_modifier_spec.rb +123 -0
  41. data/spec/unit/defmastership/{ref_changer_spec.rb → change_ref_line_modifier_spec.rb} +49 -26
  42. data/spec/unit/defmastership/change_ref_modifier_spec.rb +76 -0
  43. data/spec/unit/defmastership/comment_filter_spec.rb +9 -4
  44. data/spec/unit/defmastership/csv_formatter_body_spec.rb +89 -82
  45. data/spec/unit/defmastership/csv_formatter_header_spec.rb +69 -22
  46. data/spec/unit/defmastership/csv_formatter_spec.rb +209 -110
  47. data/spec/unit/defmastership/definition_parser_spec.rb +63 -0
  48. data/spec/unit/defmastership/definition_spec.rb +46 -4
  49. data/spec/unit/defmastership/document_spec.rb +237 -35
  50. data/spec/unit/defmastership/rename_included_files_line_modifier_spec.rb +203 -0
  51. data/spec/unit/defmastership/rename_included_files_modifier_spec.rb +67 -0
  52. data/spec/unit/defmastership/update_def_checksum_line_modifier_spec.rb +68 -0
  53. data/spec/unit/defmastership/update_def_checksum_modifier_spec.rb +75 -0
  54. data/spec/unit/defmastership_spec.rb +1 -0
  55. metadata +49 -17
  56. data/Gemfile.lock +0 -140
  57. data/lib/defmastership/batch_changer.rb +0 -40
  58. data/lib/defmastership/project_ref_changer.rb +0 -27
  59. data/spec/unit/defmastership/batch_changer_spec.rb +0 -108
  60. data/spec/unit/defmastership/project_ref_changer_spec.rb +0 -79
@@ -0,0 +1,76 @@
1
+ # Copyright (c) 2020 Jerome Arbez-Gindre
2
+ # frozen_string_literal: true
3
+
4
+ require('defmastership')
5
+
6
+ RSpec.describe(DefMastership::ChangeRefModifier) do
7
+ subject(:modifier) do
8
+ described_class.new(
9
+ 'fake config'
10
+ )
11
+ end
12
+
13
+ let(:adoc_texts) do
14
+ {
15
+ 'file1.adoc' => "file1 line1\nfile1 line2",
16
+ 'file2.adoc' => "file2 line1\nfile2 line2"
17
+ }
18
+ end
19
+
20
+ describe '.new' do
21
+ it { is_expected.not_to(be(nil)) }
22
+ it { is_expected.to(have_attributes(config: 'fake config')) }
23
+ it { is_expected.to(have_attributes(changes: [])) }
24
+ end
25
+
26
+ describe '#do_modifications' do
27
+ let(:line_modifier) { instance_double(DefMastership::ChangeRefLineModifier, 'lineModifier') }
28
+
29
+ before do
30
+ allow(DefMastership::ChangeRefLineModifier).to(
31
+ receive(:from_config).with('fake config').and_return(line_modifier)
32
+ )
33
+ allow(line_modifier).to(receive(:replace_refdef).with("file1 line1\n").and_return("new file1 line1\n"))
34
+ allow(line_modifier).to(receive(:replace_refdef).with('file1 line2').and_return('new file1 line2'))
35
+ allow(line_modifier).to(receive(:replace_refdef).with("file2 line1\n").and_return("new file2 line1\n"))
36
+ allow(line_modifier).to(receive(:replace_refdef).with('file2 line2').and_return('new file2 line2'))
37
+ allow(line_modifier).to(receive(:replace_irefs).with("new file1 line1\n").and_return("new2 file1 line1\n"))
38
+ allow(line_modifier).to(receive(:replace_irefs).with('new file1 line2').and_return('new2 file1 line2'))
39
+ allow(line_modifier).to(receive(:replace_irefs).with("new file2 line1\n").and_return("new2 file2 line1\n"))
40
+ allow(line_modifier).to(receive(:replace_irefs).with('new file2 line2').and_return('new2 file2 line2'))
41
+ allow(line_modifier).to(receive(:config).and_return('new fake config'))
42
+ allow(line_modifier).to(receive(:changes).and_return([%w[from1 to1], %w[from2 to2]]))
43
+ end
44
+
45
+ context 'when detailed expectations' do
46
+ before { modifier.do_modifications(adoc_texts) }
47
+
48
+ it do
49
+ expect(DefMastership::ChangeRefLineModifier).to(
50
+ have_received(:from_config).with('fake config')
51
+ )
52
+ end
53
+
54
+ it { expect(line_modifier).to(have_received(:replace_refdef).with("file1 line1\n")) }
55
+ it { expect(line_modifier).to(have_received(:replace_refdef).with('file1 line2')) }
56
+ it { expect(line_modifier).to(have_received(:replace_refdef).with("file2 line1\n")) }
57
+ it { expect(line_modifier).to(have_received(:replace_refdef).with('file2 line2')) }
58
+ it { expect(line_modifier).to(have_received(:replace_irefs).with("new file1 line1\n")) }
59
+ it { expect(line_modifier).to(have_received(:replace_irefs).with('new file1 line2')) }
60
+ it { expect(line_modifier).to(have_received(:replace_irefs).with("new file2 line1\n")) }
61
+ it { expect(line_modifier).to(have_received(:replace_irefs).with('new file2 line2')) }
62
+ it { expect(line_modifier).to(have_received(:config)) }
63
+ it { expect(line_modifier).to(have_received(:changes)) }
64
+ it { is_expected.to(have_attributes(config: 'new fake config')) }
65
+ it { is_expected.to(have_attributes(changes: [%w[from1 to1], %w[from2 to2]])) }
66
+ end
67
+
68
+ it do
69
+ expected_adoc = {
70
+ 'file1.adoc' => "new2 file1 line1\nnew2 file1 line2",
71
+ 'file2.adoc' => "new2 file2 line1\nnew2 file2 line2"
72
+ }
73
+ expect(modifier.do_modifications(adoc_texts)).to(eq(expected_adoc))
74
+ end
75
+ end
76
+ end
@@ -1,3 +1,4 @@
1
+ # Copyright (c) 2020 Jerome Arbez-Gindre
1
2
  # frozen_string_literal: true
2
3
 
3
4
  require('defmastership')
@@ -74,8 +75,10 @@ RSpec.describe(DefMastership::CommentFilter) do
74
75
  end
75
76
 
76
77
  before do
77
- allow(DefMastership).to(receive(:comment_filter)
78
- .and_return(comment_filter))
78
+ allow(DefMastership).to(
79
+ receive(:comment_filter)
80
+ .and_return(comment_filter)
81
+ )
79
82
  end
80
83
 
81
84
  context 'when not .commented?' do
@@ -93,8 +96,10 @@ RSpec.describe(DefMastership::CommentFilter) do
93
96
 
94
97
  context 'when .commented?' do
95
98
  before do
96
- allow(comment_filter).to(receive(:accept?)
97
- .with('blabla').and_return(false))
99
+ allow(comment_filter).to(
100
+ receive(:accept?)
101
+ .with('blabla').and_return(false)
102
+ )
98
103
  end
99
104
 
100
105
  it do
@@ -1,3 +1,4 @@
1
+ # Copyright (c) 2020 Jerome Arbez-Gindre
1
2
  # frozen_string_literal: true
2
3
 
3
4
  require('defmastership')
@@ -12,156 +13,162 @@ RSpec.describe(DefMastership::CSVFormatterBody) do
12
13
  it { is_expected.not_to(be(nil)) }
13
14
  end
14
15
 
15
- describe '#fixed_body' do
16
+ describe '#fixed' do
16
17
  before do
17
18
  allow(definition).to(receive(:type).with(no_args).and_return('a'))
18
19
  allow(definition).to(receive(:reference).with(no_args).and_return('b'))
19
20
  allow(definition).to(receive(:value).with(no_args).and_return('c'))
20
- formatter.fixed_body(definition)
21
+ allow(definition).to(receive(:sha256).with(no_args).and_return('d'))
22
+ formatter.fixed(definition)
21
23
  end
22
24
 
23
25
  it { expect(definition).to(have_received(:type).with(no_args)) }
24
-
25
26
  it { expect(definition).to(have_received(:reference).with(no_args)) }
26
-
27
27
  it { expect(definition).to(have_received(:value).with(no_args)) }
28
-
29
- it { expect(formatter.fixed_body(definition)).to(eq(%w[a b c])) }
28
+ it { expect(definition).to(have_received(:sha256).with(no_args)) }
29
+ it { expect(formatter.fixed(definition)).to(eq(%w[a b c d])) }
30
30
  end
31
31
 
32
- describe '#labels_body' do
33
- context 'when no labels on document' do
32
+ describe '#wrong_explicit_checksum' do
33
+ context 'when no wrong_explicit checksum' do
34
34
  before do
35
- allow(document).to(receive(:labels).with(no_args).and_return([]))
36
- formatter.labels_body(definition)
35
+ allow(definition).to(receive(:wrong_explicit_checksum).with(no_args).and_return(nil))
36
+ formatter.wrong_explicit_checksum(definition)
37
37
  end
38
38
 
39
- it { expect(document).to(have_received(:labels).once.with(no_args)) }
40
-
41
- it { expect(formatter.labels_body(definition)).to(eq([])) }
39
+ it { expect(definition).to(have_received(:wrong_explicit_checksum).with(no_args)) }
40
+ it { expect(formatter.wrong_explicit_checksum(definition)).to(eq([''])) }
42
41
  end
43
42
 
44
- context 'when labels on document' do
45
- before { allow(document).to(receive(:labels).with(no_args).and_return(['whatever'])) }
43
+ context 'when explicit checksum' do
44
+ before do
45
+ allow(definition).to(receive(:wrong_explicit_checksum).with(no_args).and_return('ab12'))
46
+ formatter.wrong_explicit_checksum(definition)
47
+ end
48
+
49
+ it { expect(formatter.wrong_explicit_checksum(definition)).to(eq(['ab12'])) }
50
+ end
51
+ end
46
52
 
47
- context 'when no labels on definition' do
48
- before do
49
- allow(definition).to(receive(:labels).with(no_args).and_return([]))
50
- formatter.labels_body(definition)
51
- end
53
+ describe '#explicit_version' do
54
+ context 'when no explicit_version' do
55
+ before do
56
+ allow(definition).to(receive(:explicit_version).with(no_args).and_return(nil))
57
+ formatter.explicit_version(definition)
58
+ end
52
59
 
53
- it { expect(definition).to(have_received(:labels).once.with(no_args)) }
60
+ it { expect(definition).to(have_received(:explicit_version).with(no_args)) }
61
+ it { expect(formatter.explicit_version(definition)).to(eq([''])) }
62
+ end
54
63
 
55
- it { expect(formatter.labels_body(definition)).to(eq([''])) }
64
+ context 'when explicit_version' do
65
+ before do
66
+ allow(definition).to(receive(:explicit_version).with(no_args).and_return('ab12'))
67
+ formatter.explicit_version(definition)
56
68
  end
57
69
 
58
- context 'when labels on definition' do
59
- before do
60
- allow(definition).to(receive(:labels).with(no_args).and_return(%w[toto tutu]))
61
- formatter.labels_body(definition)
62
- end
70
+ it { expect(formatter.explicit_version(definition)).to(eq(['ab12'])) }
71
+ end
72
+ end
63
73
 
64
- it { expect(definition).to(have_received(:labels).once.with(no_args)) }
74
+ describe '#labels' do
75
+ before { allow(document).to(receive(:labels).with(no_args).and_return(['whatever'])) }
65
76
 
66
- it { expect(formatter.labels_body(definition)).to(eq(["toto\ntutu"])) }
77
+ context 'when no labels on definition' do
78
+ before do
79
+ allow(definition).to(receive(:labels).with(no_args).and_return([]))
80
+ formatter.labels(definition)
67
81
  end
82
+
83
+ it { expect(definition).to(have_received(:labels).once.with(no_args)) }
84
+ it { expect(formatter.labels(definition)).to(eq([''])) }
85
+ end
86
+
87
+ context 'when labels on definition' do
88
+ before do
89
+ allow(definition).to(receive(:labels).with(no_args).and_return(%w[toto tutu]))
90
+ formatter.labels(definition)
91
+ end
92
+
93
+ it { expect(definition).to(have_received(:labels).once.with(no_args)) }
94
+ it { expect(formatter.labels(definition)).to(eq(["toto\ntutu"])) }
68
95
  end
69
96
  end
70
97
 
71
- describe '#eref_body' do
98
+ describe '#eref' do
72
99
  context 'when no eref on the document' do
73
100
  before do
74
101
  allow(document).to(receive(:eref).with(no_args).and_return({}))
75
- formatter.eref_body(definition)
102
+ formatter.eref(definition)
76
103
  end
77
104
 
78
105
  it { expect(document).to(have_received(:eref).with(no_args)) }
79
-
80
- it { expect(formatter.eref_body(nil)).to(eq([])) }
106
+ it { expect(formatter.eref(nil)).to(eq([])) }
81
107
  end
82
108
 
83
109
  context 'when eref on the document' do
84
110
  before do
85
- allow(document).to(receive(:eref).with(no_args).and_return(
86
- a: 'whatever',
87
- b: 'whatever',
88
- c: 'whatever'
89
- ))
111
+ allow(document).to(
112
+ receive(:eref).with(no_args).and_return(
113
+ a: 'whatever', b: 'whatever', c: 'whatever'
114
+ )
115
+ )
90
116
  allow(definition).to(receive(:eref).with(no_args).and_return(a: %w[A B], b: [], c: ['C']))
91
- formatter.eref_body(definition)
117
+ formatter.eref(definition)
92
118
  end
93
119
 
94
120
  it { expect(definition).to(have_received(:eref).exactly(3).times.with(no_args)) }
95
-
96
- it { expect(formatter.eref_body(definition)).to(eq(["A\nB", '', 'C'])) }
121
+ it { expect(formatter.eref(definition)).to(eq(["A\nB", '', 'C'])) }
97
122
  end
98
123
  end
99
124
 
100
- describe '#iref_body' do
101
- context 'when no iref on the document' do
125
+ describe '#iref' do
126
+ before { allow(document).to(receive(:iref).with(no_args).and_return(true)) }
127
+
128
+ context 'when no iref on the definition' do
102
129
  before do
103
- allow(document).to(receive(:iref).with(no_args).and_return(false))
104
- formatter.iref_body(definition)
130
+ allow(definition).to(receive(:iref).with(no_args).and_return([]))
131
+ formatter.iref(definition)
105
132
  end
106
133
 
107
- it { expect(document).to(have_received(:iref).with(no_args)) }
108
-
109
- it { expect(formatter.iref_body(definition)).to(eq([])) }
134
+ it { expect(definition).to(have_received(:iref).with(no_args)) }
135
+ it { expect(formatter.iref(definition)).to(eq([''])) }
110
136
  end
111
137
 
112
- context 'when iref on the document' do
113
- before { allow(document).to(receive(:iref).with(no_args).and_return(true)) }
114
-
115
- context 'when no iref on the definition' do
116
- before do
117
- allow(definition).to(receive(:iref).with(no_args).and_return([]))
118
- formatter.iref_body(definition)
119
- end
120
-
121
- it { expect(definition).to(have_received(:iref).with(no_args)) }
122
-
123
- it { expect(formatter.iref_body(definition)).to(eq([''])) }
138
+ context 'when iref on the definition' do
139
+ before do
140
+ allow(definition).to(receive(:iref).with(no_args).and_return(%w[A B]))
141
+ formatter.iref(definition)
124
142
  end
125
143
 
126
- context 'when iref on the definition' do
127
- before do
128
- allow(definition).to(receive(:iref).with(no_args).and_return(%w[A B]))
129
- formatter.iref_body(definition)
130
- end
131
-
132
- it { expect(definition).to(have_received(:iref).with(no_args)) }
133
-
134
- it { expect(formatter.iref_body(definition)).to(eq(["A\nB"])) }
135
- end
144
+ it { expect(definition).to(have_received(:iref).with(no_args)) }
145
+ it { expect(formatter.iref(definition)).to(eq(["A\nB"])) }
136
146
  end
137
147
  end
138
148
 
139
- describe '#attributes_body' do
149
+ describe '#attributes' do
140
150
  context 'when no attributes on the document' do
141
151
  before do
142
152
  allow(document).to(receive(:attributes).with(no_args).and_return({}))
143
- formatter.attributes_body(definition)
153
+ formatter.attributes(definition)
144
154
  end
145
155
 
146
156
  it { expect(document).to(have_received(:attributes).with(no_args)) }
147
-
148
- it { expect(formatter.attributes_body(nil)).to(eq([])) }
157
+ it { expect(formatter.attributes(nil)).to(eq([])) }
149
158
  end
150
159
 
151
160
  context 'when attributes on the document' do
152
161
  before do
153
- allow(document).to(receive(:attributes).with(no_args).and_return(
154
- a: 'whatever',
155
- b: 'whatever',
156
- c: 'whatever'
157
- ))
162
+ allow(document).to(
163
+ receive(:attributes).with(no_args)
164
+ .and_return(a: 'whatever', b: 'whatever', c: 'whatever')
165
+ )
158
166
  allow(definition).to(receive(:attributes).and_return(a: 'X', b: '', c: 'Y'))
159
- formatter.attributes_body(definition)
167
+ formatter.attributes(definition)
160
168
  end
161
169
 
162
170
  it { expect(definition).to(have_received(:attributes).exactly(3).times) }
163
-
164
- it { expect(formatter.attributes_body(definition)).to(eq(['X', '', 'Y'])) }
171
+ it { expect(formatter.attributes(definition)).to(eq(['X', '', 'Y'])) }
165
172
  end
166
173
  end
167
174
  end
@@ -1,3 +1,4 @@
1
+ # Copyright (c) 2020 Jerome Arbez-Gindre
1
2
  # frozen_string_literal: true
2
3
 
3
4
  require('defmastership')
@@ -12,88 +13,134 @@ RSpec.describe(DefMastership::CSVFormatterHeader) do
12
13
  end
13
14
 
14
15
  describe '#header' do
15
- describe '#fixed_header' do
16
- it { expect(formatter.fixed_header).to(eq(%w[Type Reference Value])) }
16
+ describe '#fixed' do
17
+ it { expect(formatter.fixed).to(eq(%w[Type Reference Value Checksum])) }
17
18
  end
18
19
 
19
- describe '#labels_header' do
20
+ describe '#explicit_version' do
21
+ context 'when no explicit version' do
22
+ before do
23
+ allow(document).to(receive(:explicit_version?).and_return(false))
24
+ formatter.explicit_version
25
+ end
26
+
27
+ it { expect(document).to(have_received(:explicit_version?)) }
28
+
29
+ it { expect(formatter.explicit_version).to(eq([])) }
30
+ end
31
+
32
+ context 'when explicit version' do
33
+ before do
34
+ allow(document).to(receive(:explicit_version?).and_return(true))
35
+ formatter.explicit_version
36
+ end
37
+
38
+ it { expect(formatter.explicit_version).to(eq(['Version'])) }
39
+ end
40
+ end
41
+
42
+ describe '#wrong_explicit_checksum' do
43
+ context 'when no wrong explicit checksum' do
44
+ before do
45
+ allow(document).to(receive(:wrong_explicit_checksum?).and_return(false))
46
+ formatter.wrong_explicit_checksum
47
+ end
48
+
49
+ it { expect(document).to(have_received(:wrong_explicit_checksum?)) }
50
+
51
+ it { expect(formatter.wrong_explicit_checksum).to(eq([])) }
52
+ end
53
+
54
+ context 'when wrong explicit checksum' do
55
+ before do
56
+ allow(document).to(receive(:wrong_explicit_checksum?).and_return(true))
57
+ formatter.wrong_explicit_checksum
58
+ end
59
+
60
+ it { expect(formatter.wrong_explicit_checksum).to(eq(['Wrong explicit checksum'])) }
61
+ end
62
+ end
63
+
64
+ describe '#labels' do
20
65
  context 'when no labels' do
21
66
  before do
22
67
  allow(document).to(receive(:labels).and_return([]))
23
- formatter.labels_header
68
+ formatter.labels
24
69
  end
25
70
 
26
71
  it { expect(document).to(have_received(:labels)) }
27
72
 
28
- it { expect(formatter.labels_header).to(eq([])) }
73
+ it { expect(formatter.labels).to(eq([])) }
29
74
  end
30
75
 
31
76
  context 'when there is labels' do
32
77
  before { allow(document).to(receive(:labels).and_return(['Whatever'])) }
33
78
 
34
- it { expect(formatter.labels_header).to(eq(['Labels'])) }
79
+ it { expect(formatter.labels).to(eq(['Labels'])) }
35
80
  end
36
81
  end
37
82
 
38
- describe '#eref_header' do
83
+ describe '#eref' do
39
84
  context 'when no eref' do
40
85
  before do
41
86
  allow(document).to(receive(:eref).and_return({}))
42
- formatter.eref_header
87
+ formatter.eref
43
88
  end
44
89
 
45
90
  it { expect(document).to(have_received(:eref)) }
46
91
 
47
- it { expect(formatter.eref_header).to(eq([])) }
92
+ it { expect(formatter.eref).to(eq([])) }
48
93
  end
49
94
 
50
95
  context 'when eref' do
51
96
  before do
52
- allow(document).to(receive(:eref).and_return(
53
- whatever: { prefix: 'A' },
54
- other: { prefix: 'C', url: 'D' }
55
- ))
97
+ allow(document).to(
98
+ receive(:eref).and_return(
99
+ whatever: { prefix: 'A' },
100
+ other: { prefix: 'C', url: 'D' }
101
+ )
102
+ )
56
103
  end
57
104
 
58
- it { expect(formatter.eref_header).to(eq(['A', 'C D'])) }
105
+ it { expect(formatter.eref).to(eq(%w[A C])) }
59
106
  end
60
107
  end
61
108
 
62
- describe '#iref_header' do
109
+ describe '#iref' do
63
110
  context 'when no iref' do
64
111
  before do
65
112
  allow(document).to(receive(:iref).and_return(false))
66
- formatter.iref_header
113
+ formatter.iref
67
114
  end
68
115
 
69
116
  it { expect(document).to(have_received(:iref)) }
70
117
 
71
- it { expect(formatter.iref_header).to(eq([])) }
118
+ it { expect(formatter.iref).to(eq([])) }
72
119
  end
73
120
 
74
121
  context 'when iref' do
75
122
  before { allow(document).to(receive(:iref).and_return(true)) }
76
123
 
77
- it { expect(formatter.iref_header).to(eq(['Internal links'])) }
124
+ it { expect(formatter.iref).to(eq(['Internal links'])) }
78
125
  end
79
126
  end
80
127
 
81
- describe '#attributes_header' do
128
+ describe '#attributes' do
82
129
  context 'when no attributes' do
83
130
  before do
84
131
  allow(document).to(receive(:attributes).and_return({}))
85
- formatter.attributes_header
132
+ formatter.attributes
86
133
  end
87
134
 
88
135
  it { expect(document).to(have_received(:attributes)) }
89
136
 
90
- it { expect(formatter.attributes_header).to(eq([])) }
137
+ it { expect(formatter.attributes).to(eq([])) }
91
138
  end
92
139
 
93
140
  context 'when attributes' do
94
141
  before { allow(document).to(receive(:attributes).and_return(whatever: 'A', other: 'B')) }
95
142
 
96
- it { expect(formatter.attributes_header).to(eq(%w[A B])) }
143
+ it { expect(formatter.attributes).to(eq(%w[A B])) }
97
144
  end
98
145
  end
99
146
  end