defmastership 1.0.17 → 1.0.19
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.gitlab-ci.yml +37 -11
- data/Gemfile +71 -1
- data/Guardfile +44 -0
- data/Rakefile +16 -61
- data/bin/defmastership +9 -6
- data/config/cucumber.yml +3 -0
- data/config/mutant.yml +27 -3
- data/config/reek.yml +129 -105
- data/config/rubocop.yml +72 -28
- data/defmastership.gemspec +5 -13
- data/features/changeref.feature +0 -8
- data/features/definition_checksum.feature +30 -10
- data/features/definition_version.feature +168 -10
- data/features/export.feature +64 -17
- data/features/modify.feature +1 -5
- data/features/rename_included_files.feature +27 -4
- data/features/step_definitions/git_steps.rb +19 -0
- data/lib/defmastership/batch_modifier.rb +17 -12
- data/lib/defmastership/change_ref_modifier.rb +88 -6
- data/lib/defmastership/comment_filter.rb +1 -1
- data/lib/defmastership/constants.rb +10 -7
- data/lib/defmastership/csv_formatter.rb +16 -12
- data/lib/defmastership/csv_formatter_body.rb +18 -15
- data/lib/defmastership/csv_formatter_header.rb +1 -1
- data/lib/defmastership/definition.rb +59 -20
- data/lib/defmastership/document.rb +101 -74
- data/lib/defmastership/matching_line.rb +17 -0
- data/lib/defmastership/modifier.rb +42 -0
- data/lib/defmastership/modifier_factory.rb +12 -0
- data/lib/defmastership/parsing_state.rb +15 -9
- data/lib/defmastership/rename_included_files_modifier.rb +172 -5
- data/lib/defmastership/set_join_hack.rb +11 -0
- data/lib/defmastership/update_def_checksum_modifier.rb +8 -13
- data/lib/defmastership/update_def_modifier.rb +49 -0
- data/lib/defmastership/update_def_version_modifier.rb +81 -15
- data/lib/defmastership/version.rb +1 -1
- data/lib/defmastership.rb +1 -6
- data/spec/spec_helper.rb +3 -1
- data/spec/unit/def_mastership/batch_modifier_spec.rb +40 -36
- data/spec/unit/def_mastership/change_ref_modifier_spec.rb +196 -51
- data/spec/unit/def_mastership/csv_formatter_body_spec.rb +60 -31
- data/spec/unit/def_mastership/csv_formatter_header_spec.rb +1 -1
- data/spec/unit/def_mastership/csv_formatter_spec.rb +79 -87
- data/spec/unit/def_mastership/definition_parser_spec.rb +1 -1
- data/spec/unit/def_mastership/definition_spec.rb +16 -6
- data/spec/unit/def_mastership/document_spec.rb +81 -38
- data/spec/unit/def_mastership/matching_line_spec.rb +37 -0
- data/spec/unit/def_mastership/modifier_factory_spec.rb +38 -0
- data/spec/unit/def_mastership/modifier_spec.rb +85 -0
- data/spec/unit/def_mastership/parsing_state_spec.rb +1 -1
- data/spec/unit/def_mastership/rename_included_files_modifier_spec.rb +219 -47
- data/spec/unit/def_mastership/string_spec.rb +1 -1
- data/spec/unit/def_mastership/update_def_checksum_modifier_spec.rb +82 -50
- data/spec/unit/def_mastership/update_def_modifier_spec.rb +121 -0
- data/spec/unit/def_mastership/update_def_version_modifier_spec.rb +327 -56
- data/tasks/code_quality.rake +74 -0
- data/tasks/console.rake +8 -0
- data/tasks/package.task +9 -0
- data/tasks/test.rake +30 -0
- metadata +33 -145
- data/.rubocop.yml +0 -76
- data/config/devtools.yml +0 -2
- data/config/flay.yml +0 -3
- data/config/flog.yml +0 -2
- data/config/yardstick.yml +0 -2
- data/cucumber.yml +0 -2
- data/lib/defmastership/change_ref_line_modifier.rb +0 -85
- data/lib/defmastership/line_modifier_base.rb +0 -29
- data/lib/defmastership/modifier_base.rb +0 -36
- data/lib/defmastership/rename_included_files_line_modifier.rb +0 -126
- data/lib/defmastership/update_def_checksum_line_modifier.rb +0 -38
- data/lib/defmastership/update_def_version_line_modifier.rb +0 -58
- data/spec/unit/def_mastership/change_ref_line_modifier_spec.rb +0 -250
- data/spec/unit/def_mastership/rename_included_files_line_modifier_spec.rb +0 -207
- data/spec/unit/def_mastership/update_def_checksum_line_modifier_spec.rb +0 -82
- data/spec/unit/def_mastership/update_def_version_line_modifier_spec.rb +0 -131
- /data/{.rspec → config/rspec} +0 -0
@@ -1,131 +0,0 @@
|
|
1
|
-
# Copyright (c) 2020 Jerome Arbez-Gindre
|
2
|
-
# frozen_string_literal: true
|
3
|
-
|
4
|
-
require('defmastership')
|
5
|
-
|
6
|
-
RSpec.describe(DefMastership::UpdateDefVersionLineModifier) do
|
7
|
-
subject(:linemodifier) { described_class.new }
|
8
|
-
|
9
|
-
describe '.new' do
|
10
|
-
it { is_expected.not_to(be_nil) }
|
11
|
-
it { is_expected.to(have_attributes(def_type: '')) }
|
12
|
-
it { is_expected.to(have_attributes(changes: [])) }
|
13
|
-
|
14
|
-
it do
|
15
|
-
expect { linemodifier.user_defined_attribute }
|
16
|
-
.to(raise_error(NoMethodError))
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
describe '.from_config' do
|
21
|
-
subject(:linemodifier) do
|
22
|
-
described_class.from_config(
|
23
|
-
def_type: 'requirement',
|
24
|
-
first_version: 'a'
|
25
|
-
)
|
26
|
-
end
|
27
|
-
|
28
|
-
it { is_expected.not_to(be_nil) }
|
29
|
-
it { is_expected.to(have_attributes(def_type: 'requirement')) }
|
30
|
-
it { is_expected.to(have_attributes(first_version: 'a')) }
|
31
|
-
it { is_expected.to(have_attributes(document: nil)) }
|
32
|
-
it { is_expected.to(have_attributes(ref_document: nil)) }
|
33
|
-
end
|
34
|
-
|
35
|
-
describe '#replace' do
|
36
|
-
subject(:linemodifier) do
|
37
|
-
described_class.from_config(
|
38
|
-
def_type: 'requirement',
|
39
|
-
first_version: 'a'
|
40
|
-
)
|
41
|
-
end
|
42
|
-
|
43
|
-
let(:document) { instance_double(DefMastership::Document, 'document') }
|
44
|
-
let(:ref_document) { instance_double(DefMastership::Document, 'ref_document') }
|
45
|
-
let(:definition) { instance_double(DefMastership::Definition, 'definition') }
|
46
|
-
let(:ref_definition) { instance_double(DefMastership::Definition, 'ref_definitions') }
|
47
|
-
|
48
|
-
before do
|
49
|
-
linemodifier.document = document
|
50
|
-
linemodifier.ref_document = ref_document
|
51
|
-
allow(File).to(receive(:rename))
|
52
|
-
end
|
53
|
-
|
54
|
-
context 'when definition has not the good type' do
|
55
|
-
it do
|
56
|
-
expect(linemodifier.replace('[define,req,REFERENCE]'))
|
57
|
-
.to(eq('[define,req,REFERENCE]'))
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
61
|
-
context 'when definition has the good type' do
|
62
|
-
before do
|
63
|
-
allow(document).to(receive(:ref_to_def).with('REFERENCE').and_return(definition))
|
64
|
-
allow(definition).to(receive(:sha256).and_return('~abcd1234'))
|
65
|
-
end
|
66
|
-
|
67
|
-
context 'when definition has NOT changed' do
|
68
|
-
before do
|
69
|
-
allow(ref_document).to(receive(:ref_to_def).with('REFERENCE').and_return(ref_definition))
|
70
|
-
allow(ref_definition).to(receive(:sha256).and_return('~abcd1234'))
|
71
|
-
end
|
72
|
-
|
73
|
-
it do
|
74
|
-
allow(ref_definition).to(receive(:explicit_version).and_return(nil))
|
75
|
-
expect(linemodifier.replace('[define,requirement,REFERENCE]'))
|
76
|
-
.to(eq('[define,requirement,REFERENCE]'))
|
77
|
-
end
|
78
|
-
|
79
|
-
it do
|
80
|
-
allow(ref_definition).to(receive(:explicit_version).and_return('c'))
|
81
|
-
expect(linemodifier.replace('[define,requirement,REFERENCE]'))
|
82
|
-
.to(eq('[define,requirement,REFERENCE(c)]'))
|
83
|
-
end
|
84
|
-
|
85
|
-
it do
|
86
|
-
allow(ref_definition).to(receive(:explicit_version).and_return('c'))
|
87
|
-
expect(linemodifier.replace('[define,requirement,REFERENCE(tyty~1234)]'))
|
88
|
-
.to(eq('[define,requirement,REFERENCE(c~1234)]'))
|
89
|
-
end
|
90
|
-
end
|
91
|
-
|
92
|
-
context 'when definition has changed' do
|
93
|
-
before do
|
94
|
-
allow(ref_document).to(receive(:ref_to_def).with('REFERENCE').and_return(ref_definition))
|
95
|
-
allow(ref_definition).to(receive(:sha256).and_return('~4321aaaa'))
|
96
|
-
end
|
97
|
-
|
98
|
-
[
|
99
|
-
[nil, '', '(a)'],
|
100
|
-
['c', '', '(d)'],
|
101
|
-
['c', '(tyty~1234)', '(d~1234)'],
|
102
|
-
['2', '', '(3)'],
|
103
|
-
['1222', '', '(1223)'],
|
104
|
-
['abb', '', '(abc)']
|
105
|
-
].each do |ref, from, to|
|
106
|
-
it do
|
107
|
-
allow(ref_definition).to(receive(:explicit_version).and_return(ref))
|
108
|
-
expect(linemodifier.replace("[define,requirement,REFERENCE#{from}]"))
|
109
|
-
.to(eq("[define,requirement,REFERENCE#{to}]"))
|
110
|
-
end
|
111
|
-
end
|
112
|
-
end
|
113
|
-
|
114
|
-
context 'when definition is new' do
|
115
|
-
before do
|
116
|
-
allow(ref_document).to(receive(:ref_to_def).with('REFERENCE').and_return(nil))
|
117
|
-
end
|
118
|
-
|
119
|
-
it do
|
120
|
-
expect(linemodifier.replace('[define,requirement,REFERENCE(whatever)]'))
|
121
|
-
.to(eq('[define,requirement,REFERENCE]'))
|
122
|
-
end
|
123
|
-
|
124
|
-
it do
|
125
|
-
expect(linemodifier.replace('[define,requirement,REFERENCE(~1234)]'))
|
126
|
-
.to(eq('[define,requirement,REFERENCE(~1234)]'))
|
127
|
-
end
|
128
|
-
end
|
129
|
-
end
|
130
|
-
end
|
131
|
-
end
|
/data/{.rspec → config/rspec}
RENAMED
File without changes
|