defmastership 1.0.7 → 1.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/defmastership +1 -1
- data/features/{checksum.feature → definition_checksum.feature} +31 -31
- data/features/definition_version.feature +24 -0
- data/features/export.feature +21 -21
- data/features/modify.feature +23 -1
- data/lib/defmastership/batch_modifier.rb +2 -0
- data/lib/defmastership/constants.rb +2 -2
- data/lib/defmastership/csv_formatter.rb +12 -6
- data/lib/defmastership/csv_formatter_body.rb +8 -5
- data/lib/defmastership/csv_formatter_header.rb +5 -1
- data/lib/defmastership/definition.rb +4 -4
- data/lib/defmastership/document.rb +11 -15
- data/lib/defmastership/version.rb +1 -1
- data/spec/unit/defmastership/batch_modifier_spec.rb +8 -0
- data/spec/unit/defmastership/csv_formatter_body_spec.rb +42 -60
- data/spec/unit/defmastership/csv_formatter_header_spec.rb +23 -1
- data/spec/unit/defmastership/csv_formatter_spec.rb +204 -67
- data/spec/unit/defmastership/definition_spec.rb +19 -4
- data/spec/unit/defmastership/document_spec.rb +71 -4
- data/spec/unit/defmastership/update_def_checksum_line_modifier_spec.rb +4 -4
- metadata +4 -3
@@ -23,6 +23,7 @@ RSpec.describe(DefMastership::Definition) do
|
|
23
23
|
it { is_expected.to(have_attributes(attributes: {})) }
|
24
24
|
it { is_expected.to(have_attributes(labels: Set.new)) }
|
25
25
|
it { is_expected.to(have_attributes(wrong_explicit_checksum: nil)) }
|
26
|
+
it { is_expected.to(have_attributes(explicit_version: nil)) }
|
26
27
|
end
|
27
28
|
|
28
29
|
context 'with labels' do
|
@@ -42,13 +43,13 @@ RSpec.describe(DefMastership::Definition) do
|
|
42
43
|
described_class.new(
|
43
44
|
type: 'req',
|
44
45
|
reference: 'TUTU-001',
|
45
|
-
explicit_checksum: '8cc259e6'
|
46
|
+
explicit_checksum: '~8cc259e6'
|
46
47
|
)
|
47
48
|
end
|
48
49
|
|
49
50
|
it do
|
50
|
-
definition << 'def value with a checksum != 8cc259e6'
|
51
|
-
expect(definition).to(have_attributes(wrong_explicit_checksum: '8cc259e6'))
|
51
|
+
definition << 'def value with a checksum != ~8cc259e6'
|
52
|
+
expect(definition).to(have_attributes(wrong_explicit_checksum: '~8cc259e6'))
|
52
53
|
end
|
53
54
|
|
54
55
|
it do
|
@@ -56,6 +57,20 @@ RSpec.describe(DefMastership::Definition) do
|
|
56
57
|
expect(definition).to(have_attributes(wrong_explicit_checksum: nil))
|
57
58
|
end
|
58
59
|
end
|
60
|
+
|
61
|
+
context 'with explicit_version' do
|
62
|
+
subject(:definition) do
|
63
|
+
described_class.new(
|
64
|
+
type: 'req',
|
65
|
+
reference: 'TUTU-001',
|
66
|
+
explicit_version: 'pouet'
|
67
|
+
)
|
68
|
+
end
|
69
|
+
|
70
|
+
it do
|
71
|
+
expect(definition).to(have_attributes(explicit_version: 'pouet'))
|
72
|
+
end
|
73
|
+
end
|
59
74
|
end
|
60
75
|
|
61
76
|
describe '#<<' do
|
@@ -88,7 +103,7 @@ RSpec.describe(DefMastership::Definition) do
|
|
88
103
|
|
89
104
|
it 'calculates sha256 of value' do
|
90
105
|
definition << 'first line' << 'second line'
|
91
|
-
expect(definition.sha256).to(eq('beb0535a'))
|
106
|
+
expect(definition.sha256).to(eq('~beb0535a'))
|
92
107
|
end
|
93
108
|
end
|
94
109
|
|
@@ -52,12 +52,12 @@ RSpec.describe(DefMastership::Document) do
|
|
52
52
|
end
|
53
53
|
|
54
54
|
context 'when simple definition line with explicit checksum' do
|
55
|
-
let(:input_lines) { ['[define, requirement, TOTO-0001(ab12)]'] }
|
55
|
+
let(:input_lines) { ['[define, requirement, TOTO-0001(~ab12)]'] }
|
56
56
|
|
57
57
|
before do
|
58
58
|
allow(DefMastership::Definition).to(
|
59
59
|
receive(:new).with(
|
60
|
-
matchdata_including(type: 'requirement', reference: 'TOTO-0001', explicit_checksum: 'ab12')
|
60
|
+
matchdata_including(type: 'requirement', reference: 'TOTO-0001', explicit_checksum: '~ab12')
|
61
61
|
).and_return(definition)
|
62
62
|
)
|
63
63
|
document.parse(input_lines)
|
@@ -66,7 +66,28 @@ RSpec.describe(DefMastership::Document) do
|
|
66
66
|
it do
|
67
67
|
expect(DefMastership::Definition).to(
|
68
68
|
have_received(:new).with(
|
69
|
-
matchdata_including(type: 'requirement', reference: 'TOTO-0001', explicit_checksum: 'ab12')
|
69
|
+
matchdata_including(type: 'requirement', reference: 'TOTO-0001', explicit_checksum: '~ab12')
|
70
|
+
)
|
71
|
+
)
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
context 'when simple definition line with explicit version' do
|
76
|
+
let(:input_lines) { ['[define, requirement, TOTO-0001(pouet)]'] }
|
77
|
+
|
78
|
+
before do
|
79
|
+
allow(DefMastership::Definition).to(
|
80
|
+
receive(:new).with(
|
81
|
+
matchdata_including(type: 'requirement', reference: 'TOTO-0001', explicit_version: 'pouet')
|
82
|
+
).and_return(definition)
|
83
|
+
)
|
84
|
+
document.parse(input_lines)
|
85
|
+
end
|
86
|
+
|
87
|
+
it do
|
88
|
+
expect(DefMastership::Definition).to(
|
89
|
+
have_received(:new).with(
|
90
|
+
matchdata_including(type: 'requirement', reference: 'TOTO-0001', explicit_version: 'pouet')
|
70
91
|
)
|
71
92
|
)
|
72
93
|
end
|
@@ -503,6 +524,52 @@ RSpec.describe(DefMastership::Document) do
|
|
503
524
|
end
|
504
525
|
end
|
505
526
|
|
527
|
+
describe '#explicit_version?' do
|
528
|
+
let(:def1) { instance_double(DefMastership::Definition, 'definition') }
|
529
|
+
let(:def2) { instance_double(DefMastership::Definition, 'definition') }
|
530
|
+
let(:input_lines) do
|
531
|
+
[
|
532
|
+
'[define, requirement, TOTO-0001]',
|
533
|
+
'def one',
|
534
|
+
'',
|
535
|
+
'[define, requirement, TOTO-0002]',
|
536
|
+
'def two'
|
537
|
+
]
|
538
|
+
end
|
539
|
+
|
540
|
+
before do
|
541
|
+
allow(DefMastership::Definition).to(receive(:new).twice.and_return(def1, def2))
|
542
|
+
allow(def1).to(receive(:labels)).and_return([])
|
543
|
+
allow(def2).to(receive(:labels)).and_return([])
|
544
|
+
allow(def1).to(receive(:<<).and_return(def1))
|
545
|
+
allow(def2).to(receive(:<<).and_return(def2))
|
546
|
+
end
|
547
|
+
|
548
|
+
context 'when no explicit version' do
|
549
|
+
before do
|
550
|
+
allow(def1).to(receive(:explicit_version)).and_return(nil)
|
551
|
+
allow(def2).to(receive(:explicit_version)).and_return(nil)
|
552
|
+
document.parse(input_lines)
|
553
|
+
document.explicit_version?
|
554
|
+
end
|
555
|
+
|
556
|
+
it { expect(def1).to(have_received(:explicit_version)) }
|
557
|
+
it { expect(def2).to(have_received(:explicit_version)) }
|
558
|
+
it { expect(document.explicit_version?).to(eq(false)) }
|
559
|
+
end
|
560
|
+
|
561
|
+
context 'when one req has explicit version' do
|
562
|
+
before do
|
563
|
+
allow(def1).to(receive(:explicit_version)).and_return(nil)
|
564
|
+
allow(def2).to(receive(:explicit_version)).and_return('toto')
|
565
|
+
document.parse(input_lines)
|
566
|
+
document.explicit_version?
|
567
|
+
end
|
568
|
+
|
569
|
+
it { expect(document.explicit_version?).to(eq(true)) }
|
570
|
+
end
|
571
|
+
end
|
572
|
+
|
506
573
|
describe '#ref_to_def?' do
|
507
574
|
let(:def1) { instance_double(DefMastership::Definition, 'definition') }
|
508
575
|
let(:def2) { instance_double(DefMastership::Definition, 'definition') }
|
@@ -511,7 +578,7 @@ RSpec.describe(DefMastership::Document) do
|
|
511
578
|
'[define, requirement, TOTO-0001]',
|
512
579
|
'def one',
|
513
580
|
'',
|
514
|
-
'[define, requirement, TOTO-0002(1234)]',
|
581
|
+
'[define, requirement, TOTO-0002(~1234)]',
|
515
582
|
'def two'
|
516
583
|
]
|
517
584
|
end
|
@@ -51,17 +51,17 @@ RSpec.describe(DefMastership::UpdateDefChecksumLineModifier) do
|
|
51
51
|
context 'when definition has the good type' do
|
52
52
|
before do
|
53
53
|
allow(document).to(receive(:ref_to_def).with('REFERENCE').and_return(definition))
|
54
|
-
allow(definition).to(receive(:sha256).and_return('abcd1234'))
|
54
|
+
allow(definition).to(receive(:sha256).and_return('~abcd1234'))
|
55
55
|
end
|
56
56
|
|
57
57
|
it do
|
58
58
|
expect(linemodifier.replace('[define,requirement,REFERENCE]'))
|
59
|
-
.to(eq('[define,requirement,REFERENCE(abcd1234)]'))
|
59
|
+
.to(eq('[define,requirement,REFERENCE(~abcd1234)]'))
|
60
60
|
end
|
61
61
|
|
62
62
|
it do
|
63
|
-
expect(linemodifier.replace('[define,requirement,REFERENCE(bad)]'))
|
64
|
-
.to(eq('[define,requirement,REFERENCE(abcd1234)]'))
|
63
|
+
expect(linemodifier.replace('[define,requirement,REFERENCE(~bad)]'))
|
64
|
+
.to(eq('[define,requirement,REFERENCE(~abcd1234)]'))
|
65
65
|
end
|
66
66
|
end
|
67
67
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: defmastership
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jérôme Arbez-Gindre
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-03-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aruba
|
@@ -193,7 +193,8 @@ files:
|
|
193
193
|
- defmastership.gemspec
|
194
194
|
- defmastership.rdoc
|
195
195
|
- features/changeref.feature
|
196
|
-
- features/
|
196
|
+
- features/definition_checksum.feature
|
197
|
+
- features/definition_version.feature
|
197
198
|
- features/defmastership.feature
|
198
199
|
- features/export.feature
|
199
200
|
- features/modify.feature
|