defmastership 1.0.15 → 1.0.17
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 +34 -3
- data/.rubocop.yml +14 -6
- data/Rakefile +29 -15
- data/bin/defmastership +4 -4
- data/defmastership.gemspec +32 -27
- data/features/export.feature +70 -1
- data/lib/defmastership/batch_modifier.rb +1 -1
- data/lib/defmastership/change_ref_line_modifier.rb +3 -0
- data/lib/defmastership/change_ref_modifier.rb +2 -0
- data/lib/defmastership/csv_formatter.rb +4 -4
- data/lib/defmastership/document.rb +15 -9
- data/lib/defmastership/modifier_base.rb +10 -3
- data/lib/defmastership/parsing_state.rb +3 -1
- data/lib/defmastership/version.rb +1 -1
- data/lib/defmastership.rb +11 -16
- data/spec/spec_helper.rb +2 -2
- data/spec/unit/{defmastership → def_mastership}/batch_modifier_spec.rb +5 -4
- data/spec/unit/{defmastership → def_mastership}/change_ref_line_modifier_spec.rb +11 -4
- data/spec/unit/{defmastership → def_mastership}/change_ref_modifier_spec.rb +1 -1
- data/spec/unit/{defmastership → def_mastership}/csv_formatter_body_spec.rb +1 -1
- data/spec/unit/{defmastership → def_mastership}/csv_formatter_header_spec.rb +1 -1
- data/spec/unit/{defmastership → def_mastership}/csv_formatter_spec.rb +11 -8
- data/spec/unit/{defmastership → def_mastership}/definition_parser_spec.rb +1 -1
- data/spec/unit/{defmastership → def_mastership}/definition_spec.rb +1 -1
- data/spec/unit/{defmastership → def_mastership}/document_spec.rb +99 -44
- data/spec/unit/def_mastership/parsing_state_spec.rb +62 -0
- data/spec/unit/{defmastership → def_mastership}/rename_included_files_line_modifier_spec.rb +7 -3
- data/spec/unit/{defmastership → def_mastership}/rename_included_files_modifier_spec.rb +1 -1
- data/spec/unit/{defmastership → def_mastership}/update_def_checksum_line_modifier_spec.rb +7 -3
- data/spec/unit/{defmastership → def_mastership}/update_def_checksum_modifier_spec.rb +1 -1
- data/spec/unit/{defmastership → def_mastership}/update_def_version_line_modifier_spec.rb +7 -3
- data/spec/unit/{defmastership → def_mastership}/update_def_version_modifier_spec.rb +3 -3
- data/spec/unit/{defmastership_spec.rb → def_mastership_spec.rb} +1 -1
- metadata +64 -35
- data/spec/unit/defmastership/parsing_state_spec.rb +0 -48
- /data/spec/unit/{defmastership/comment_filter_spec.rb → def_mastership/string_spec.rb} +0 -0
@@ -10,7 +10,7 @@ RSpec.describe(DefMastership::CSVFormatterBody) do
|
|
10
10
|
let(:definition) { instance_double(DefMastership::Definition, 'definition') }
|
11
11
|
|
12
12
|
describe '.new' do
|
13
|
-
it { is_expected.not_to(
|
13
|
+
it { is_expected.not_to(be_nil) }
|
14
14
|
end
|
15
15
|
|
16
16
|
describe '#fixed' do
|
@@ -1,9 +1,9 @@
|
|
1
1
|
# Copyright (c) 2020 Jerome Arbez-Gindre
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
|
+
require('csv')
|
4
5
|
require('defmastership')
|
5
6
|
require('ostruct')
|
6
|
-
require('csv')
|
7
7
|
|
8
8
|
RSpec.describe(DefMastership::CSVFormatter) do
|
9
9
|
subject(:formatter) { described_class.new(document, ';') }
|
@@ -11,7 +11,7 @@ RSpec.describe(DefMastership::CSVFormatter) do
|
|
11
11
|
let(:document) { instance_double(DefMastership::Document, 'document') }
|
12
12
|
|
13
13
|
describe '.new' do
|
14
|
-
it { is_expected.not_to(
|
14
|
+
it { is_expected.not_to(be_nil) }
|
15
15
|
end
|
16
16
|
|
17
17
|
describe '#export_to' do
|
@@ -232,12 +232,7 @@ RSpec.describe(DefMastership::CSVFormatter) do
|
|
232
232
|
|
233
233
|
context 'when #export_to csv file' do
|
234
234
|
let(:target_file) { 'export.csv' }
|
235
|
-
let(:definitions)
|
236
|
-
[
|
237
|
-
OpenStruct.new(type: 'a', reference: 'b', value: 'c', sha256: 'd'),
|
238
|
-
OpenStruct.new(type: 'd', reference: 'e', value: 'f', sha256: 'g')
|
239
|
-
]
|
240
|
-
end
|
235
|
+
let(:definitions) { [double, double] }
|
241
236
|
|
242
237
|
before do
|
243
238
|
setup_aruba
|
@@ -246,6 +241,14 @@ RSpec.describe(DefMastership::CSVFormatter) do
|
|
246
241
|
allow(document).to(receive(:iref).with(no_args).and_return(false))
|
247
242
|
allow(document).to(receive(:attributes).with(no_args).and_return({}))
|
248
243
|
allow(document).to(receive(:definitions).with(no_args).and_return(definitions))
|
244
|
+
allow(definitions[0]).to(receive(:type).and_return('a'))
|
245
|
+
allow(definitions[0]).to(receive(:reference).and_return('b'))
|
246
|
+
allow(definitions[0]).to(receive(:value).and_return('c'))
|
247
|
+
allow(definitions[0]).to(receive(:sha256).and_return('d'))
|
248
|
+
allow(definitions[1]).to(receive(:type).and_return('d'))
|
249
|
+
allow(definitions[1]).to(receive(:reference).and_return('e'))
|
250
|
+
allow(definitions[1]).to(receive(:value).and_return('f'))
|
251
|
+
allow(definitions[1]).to(receive(:sha256).and_return('g'))
|
249
252
|
allow(document).to(receive(:wrong_explicit_checksum?).with(no_args).and_return(false))
|
250
253
|
allow(document).to(receive(:explicit_version?).with(no_args).and_return(false))
|
251
254
|
formatter.export_to("#{aruba.current_directory}/#{target_file}")
|
@@ -6,7 +6,7 @@ require('defmastership')
|
|
6
6
|
RSpec.describe(DefMastership::DefinitionParser) do
|
7
7
|
subject(:parser) { described_class.new(callback_object) }
|
8
8
|
|
9
|
-
let(:callback_object) {
|
9
|
+
let(:callback_object) { double }
|
10
10
|
|
11
11
|
before do
|
12
12
|
allow(callback_object).to(receive(:add_new_definition).with(any_args))
|
@@ -13,7 +13,7 @@ RSpec.describe(DefMastership::Definition) do
|
|
13
13
|
)
|
14
14
|
end
|
15
15
|
|
16
|
-
it { is_expected.not_to(
|
16
|
+
it { is_expected.not_to(be_nil) }
|
17
17
|
it { is_expected.to(have_attributes(type: 'req')) }
|
18
18
|
it { is_expected.to(have_attributes(reference: 'TUTU-001')) }
|
19
19
|
it { is_expected.to(have_attributes(lines: [])) }
|
@@ -7,7 +7,7 @@ RSpec.describe(DefMastership::Document) do
|
|
7
7
|
subject(:document) { described_class.new }
|
8
8
|
|
9
9
|
describe '.new' do
|
10
|
-
it { is_expected.not_to(
|
10
|
+
it { is_expected.not_to(be_nil) }
|
11
11
|
it { is_expected.to(have_attributes(definitions: [])) }
|
12
12
|
it { is_expected.to(have_attributes(eref: {})) }
|
13
13
|
it { is_expected.to(have_attributes(iref: false)) }
|
@@ -115,6 +115,49 @@ RSpec.describe(DefMastership::Document) do
|
|
115
115
|
it { expect(definition).to(have_received(:<<).with('b')) }
|
116
116
|
end
|
117
117
|
|
118
|
+
context 'when complete definition with content including ----' do
|
119
|
+
let(:input_lines) do
|
120
|
+
[
|
121
|
+
'[define, requirement, TOTO-0001]',
|
122
|
+
'--',
|
123
|
+
'----',
|
124
|
+
'a',
|
125
|
+
'b',
|
126
|
+
'----',
|
127
|
+
'--',
|
128
|
+
'not included'
|
129
|
+
]
|
130
|
+
end
|
131
|
+
|
132
|
+
before do
|
133
|
+
allow(definition).to(receive(:<<).and_return(definition))
|
134
|
+
document.parse(input_lines)
|
135
|
+
end
|
136
|
+
|
137
|
+
it { expect(definition).to(have_received(:<<).twice.with('----')) }
|
138
|
+
it { expect(definition).to(have_received(:<<).with('a')) }
|
139
|
+
it { expect(definition).to(have_received(:<<).with('b')) }
|
140
|
+
end
|
141
|
+
|
142
|
+
context 'when complete definition with single line comment' do
|
143
|
+
let(:input_lines) do
|
144
|
+
[
|
145
|
+
'[define, requirement, TOTO-0001]',
|
146
|
+
'--',
|
147
|
+
'// comment',
|
148
|
+
'--',
|
149
|
+
'not included'
|
150
|
+
]
|
151
|
+
end
|
152
|
+
|
153
|
+
before do
|
154
|
+
allow(definition).to(receive(:<<).and_return(definition))
|
155
|
+
document.parse(input_lines)
|
156
|
+
end
|
157
|
+
|
158
|
+
it { expect(definition).to(have_received(:<<).with('// comment')) }
|
159
|
+
end
|
160
|
+
|
118
161
|
context 'when definition with one paragraph' do
|
119
162
|
let(:input_lines) do
|
120
163
|
[
|
@@ -280,7 +323,7 @@ RSpec.describe(DefMastership::Document) do
|
|
280
323
|
it { expect(definition).to(have_received(:add_iref).with('toto')) }
|
281
324
|
it { expect(definition).to(have_received(:add_iref).with('tutu')) }
|
282
325
|
it { expect(definition).to(have_received(:add_iref).with('pouet')) }
|
283
|
-
it { expect(document.iref).to(
|
326
|
+
it { expect(document.iref).to(be(true)) }
|
284
327
|
end
|
285
328
|
|
286
329
|
context 'when configure attributes' do
|
@@ -322,7 +365,7 @@ RSpec.describe(DefMastership::Document) do
|
|
322
365
|
|
323
366
|
it do
|
324
367
|
document.parse(input_lines)
|
325
|
-
expect(document.iref).to(
|
368
|
+
expect(document.iref).to(be(false))
|
326
369
|
end
|
327
370
|
end
|
328
371
|
|
@@ -479,8 +522,12 @@ RSpec.describe(DefMastership::Document) do
|
|
479
522
|
end
|
480
523
|
|
481
524
|
describe '#wrong_explicit_checksum?' do
|
482
|
-
let(:
|
483
|
-
|
525
|
+
let(:defs) do
|
526
|
+
[
|
527
|
+
instance_double(DefMastership::Definition, 'definition'),
|
528
|
+
instance_double(DefMastership::Definition, 'definition')
|
529
|
+
]
|
530
|
+
end
|
484
531
|
let(:input_lines) do
|
485
532
|
[
|
486
533
|
'[define, requirement, TOTO-0001]',
|
@@ -492,41 +539,45 @@ RSpec.describe(DefMastership::Document) do
|
|
492
539
|
end
|
493
540
|
|
494
541
|
before do
|
495
|
-
allow(DefMastership::Definition).to(receive(:new).twice.and_return(
|
496
|
-
allow(
|
497
|
-
allow(
|
498
|
-
allow(
|
499
|
-
allow(
|
542
|
+
allow(DefMastership::Definition).to(receive(:new).twice.and_return(defs[0], defs[1]))
|
543
|
+
allow(defs[0]).to(receive(:labels)).and_return([])
|
544
|
+
allow(defs[1]).to(receive(:labels)).and_return([])
|
545
|
+
allow(defs[0]).to(receive(:<<).and_return(defs[0]))
|
546
|
+
allow(defs[1]).to(receive(:<<).and_return(defs[1]))
|
500
547
|
end
|
501
548
|
|
502
549
|
context 'when no wrong explicit checksum' do
|
503
550
|
before do
|
504
|
-
allow(
|
505
|
-
allow(
|
551
|
+
allow(defs[0]).to(receive(:wrong_explicit_checksum)).and_return(nil)
|
552
|
+
allow(defs[1]).to(receive(:wrong_explicit_checksum)).and_return(nil)
|
506
553
|
document.parse(input_lines)
|
507
554
|
document.wrong_explicit_checksum?
|
508
555
|
end
|
509
556
|
|
510
|
-
it { expect(
|
511
|
-
it { expect(
|
512
|
-
it { expect(document.wrong_explicit_checksum?).to(
|
557
|
+
it { expect(defs[0]).to(have_received(:wrong_explicit_checksum)) }
|
558
|
+
it { expect(defs[1]).to(have_received(:wrong_explicit_checksum)) }
|
559
|
+
it { expect(document.wrong_explicit_checksum?).to(be(false)) }
|
513
560
|
end
|
514
561
|
|
515
562
|
context 'when one req has wrong explicit checksum' do
|
516
563
|
before do
|
517
|
-
allow(
|
518
|
-
allow(
|
564
|
+
allow(defs[0]).to(receive(:wrong_explicit_checksum)).and_return(nil)
|
565
|
+
allow(defs[1]).to(receive(:wrong_explicit_checksum)).and_return('toto')
|
519
566
|
document.parse(input_lines)
|
520
567
|
document.wrong_explicit_checksum?
|
521
568
|
end
|
522
569
|
|
523
|
-
it { expect(document.wrong_explicit_checksum?).to(
|
570
|
+
it { expect(document.wrong_explicit_checksum?).to(be(true)) }
|
524
571
|
end
|
525
572
|
end
|
526
573
|
|
527
574
|
describe '#explicit_version?' do
|
528
|
-
let(:
|
529
|
-
|
575
|
+
let(:defs) do
|
576
|
+
[
|
577
|
+
instance_double(DefMastership::Definition, 'definition'),
|
578
|
+
instance_double(DefMastership::Definition, 'definition')
|
579
|
+
]
|
580
|
+
end
|
530
581
|
let(:input_lines) do
|
531
582
|
[
|
532
583
|
'[define, requirement, TOTO-0001]',
|
@@ -538,41 +589,45 @@ RSpec.describe(DefMastership::Document) do
|
|
538
589
|
end
|
539
590
|
|
540
591
|
before do
|
541
|
-
allow(DefMastership::Definition).to(receive(:new).twice.and_return(
|
542
|
-
allow(
|
543
|
-
allow(
|
544
|
-
allow(
|
545
|
-
allow(
|
592
|
+
allow(DefMastership::Definition).to(receive(:new).twice.and_return(defs[0], defs[1]))
|
593
|
+
allow(defs[0]).to(receive(:labels)).and_return([])
|
594
|
+
allow(defs[1]).to(receive(:labels)).and_return([])
|
595
|
+
allow(defs[0]).to(receive(:<<).and_return(defs[0]))
|
596
|
+
allow(defs[1]).to(receive(:<<).and_return(defs[1]))
|
546
597
|
end
|
547
598
|
|
548
599
|
context 'when no explicit version' do
|
549
600
|
before do
|
550
|
-
allow(
|
551
|
-
allow(
|
601
|
+
allow(defs[0]).to(receive(:explicit_version)).and_return(nil)
|
602
|
+
allow(defs[1]).to(receive(:explicit_version)).and_return(nil)
|
552
603
|
document.parse(input_lines)
|
553
604
|
document.explicit_version?
|
554
605
|
end
|
555
606
|
|
556
|
-
it { expect(
|
557
|
-
it { expect(
|
558
|
-
it { expect(document.explicit_version?).to(
|
607
|
+
it { expect(defs[0]).to(have_received(:explicit_version)) }
|
608
|
+
it { expect(defs[1]).to(have_received(:explicit_version)) }
|
609
|
+
it { expect(document.explicit_version?).to(be(false)) }
|
559
610
|
end
|
560
611
|
|
561
612
|
context 'when one req has explicit version' do
|
562
613
|
before do
|
563
|
-
allow(
|
564
|
-
allow(
|
614
|
+
allow(defs[0]).to(receive(:explicit_version)).and_return(nil)
|
615
|
+
allow(defs[1]).to(receive(:explicit_version)).and_return('toto')
|
565
616
|
document.parse(input_lines)
|
566
617
|
document.explicit_version?
|
567
618
|
end
|
568
619
|
|
569
|
-
it { expect(document.explicit_version?).to(
|
620
|
+
it { expect(document.explicit_version?).to(be(true)) }
|
570
621
|
end
|
571
622
|
end
|
572
623
|
|
573
624
|
describe '#ref_to_def?' do
|
574
|
-
let(:
|
575
|
-
|
625
|
+
let(:defs) do
|
626
|
+
[
|
627
|
+
instance_double(DefMastership::Definition, 'definition'),
|
628
|
+
instance_double(DefMastership::Definition, 'definition')
|
629
|
+
]
|
630
|
+
end
|
576
631
|
let(:input_lines) do
|
577
632
|
[
|
578
633
|
'[define, requirement, TOTO-0001]',
|
@@ -584,17 +639,17 @@ RSpec.describe(DefMastership::Document) do
|
|
584
639
|
end
|
585
640
|
|
586
641
|
before do
|
587
|
-
allow(DefMastership::Definition).to(receive(:new).twice.and_return(
|
588
|
-
allow(
|
589
|
-
allow(
|
590
|
-
allow(
|
591
|
-
allow(
|
592
|
-
allow(
|
593
|
-
allow(
|
642
|
+
allow(DefMastership::Definition).to(receive(:new).twice.and_return(defs[0], defs[1]))
|
643
|
+
allow(defs[0]).to(receive(:labels)).and_return([])
|
644
|
+
allow(defs[1]).to(receive(:labels)).and_return([])
|
645
|
+
allow(defs[0]).to(receive(:<<).and_return(defs[0]))
|
646
|
+
allow(defs[1]).to(receive(:<<).and_return(defs[1]))
|
647
|
+
allow(defs[0]).to(receive(:reference).and_return('TOTO-0001'))
|
648
|
+
allow(defs[1]).to(receive(:reference).and_return('TOTO-0002'))
|
594
649
|
document.parse(input_lines)
|
595
650
|
end
|
596
651
|
|
597
|
-
it { expect(document.ref_to_def('TOTO-0001')).to(eq(
|
598
|
-
it { expect(document.ref_to_def('TOTO-0002')).to(eq(
|
652
|
+
it { expect(document.ref_to_def('TOTO-0001')).to(eq(defs[0])) }
|
653
|
+
it { expect(document.ref_to_def('TOTO-0002')).to(eq(defs[1])) }
|
599
654
|
end
|
600
655
|
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
# Copyright (c) 2020 Jerome Arbez-Gindre
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require('defmastership')
|
5
|
+
|
6
|
+
RSpec.describe(DefMastership::ParsingState) do
|
7
|
+
subject(:parsing_state) do
|
8
|
+
described_class.new
|
9
|
+
end
|
10
|
+
|
11
|
+
describe '.new' do
|
12
|
+
it { is_expected.not_to(be_nil) }
|
13
|
+
end
|
14
|
+
|
15
|
+
describe '#enabled_with?' do
|
16
|
+
context 'when single line commment' do
|
17
|
+
it { expect(parsing_state.enabled?("//whatever\n")).to(be(false)) }
|
18
|
+
end
|
19
|
+
|
20
|
+
context 'when starting' do
|
21
|
+
it { expect(parsing_state.enabled?("whatever\n")).to(be(true)) }
|
22
|
+
it { expect(parsing_state.enabled?("----\n")).to(be(false)) }
|
23
|
+
it { expect(parsing_state.enabled?("....\n")).to(be(false)) }
|
24
|
+
it { expect(parsing_state.enabled?("////\n")).to(be(false)) }
|
25
|
+
it { expect(parsing_state.enabled?('....')).to(be(false)) }
|
26
|
+
end
|
27
|
+
|
28
|
+
context 'when disabled' do
|
29
|
+
before { parsing_state.enabled?("----\n") }
|
30
|
+
|
31
|
+
it { expect(parsing_state.enabled?("whatever\n")).to(be(false)) }
|
32
|
+
it { expect(parsing_state.enabled?("----\n")).to(be(true)) }
|
33
|
+
it { expect(parsing_state.enabled?("....\n")).to(be(false)) }
|
34
|
+
it { expect(parsing_state.enabled?("////\n")).to(be(false)) }
|
35
|
+
end
|
36
|
+
|
37
|
+
context 'with intricated disables starting with "...."' do
|
38
|
+
before do
|
39
|
+
["....\n", "----\n", "whatever\n"].each { |line| parsing_state.enabled?(line) }
|
40
|
+
end
|
41
|
+
|
42
|
+
it { expect(parsing_state.enabled?("----\n")).to(be(false)) }
|
43
|
+
it { expect(parsing_state.enabled?("....\n")).to(be(true)) }
|
44
|
+
end
|
45
|
+
|
46
|
+
context 'with intricated disables starting with "----"' do
|
47
|
+
before do
|
48
|
+
["....\n", "----\n", "whatever\n"].each { |line| parsing_state.enabled?(line) }
|
49
|
+
end
|
50
|
+
|
51
|
+
it { expect(parsing_state.enabled?("....\n")).to(be(true)) }
|
52
|
+
end
|
53
|
+
|
54
|
+
context 'with intricated disables starting with "////"' do
|
55
|
+
before do
|
56
|
+
["////\n", "----\n", "whatever\n"].each { |line| parsing_state.enabled?(line) }
|
57
|
+
end
|
58
|
+
|
59
|
+
it { expect(parsing_state.enabled?("////\n")).to(be(true)) }
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
@@ -7,11 +7,15 @@ RSpec.describe(DefMastership::RenameIncludedFilesLineModifier) do
|
|
7
7
|
subject(:includeschanger) { described_class.new }
|
8
8
|
|
9
9
|
describe '.new' do
|
10
|
-
it { is_expected.not_to(
|
10
|
+
it { is_expected.not_to(be_nil) }
|
11
11
|
it { is_expected.to(have_attributes(from_regexp: '')) }
|
12
12
|
it { is_expected.to(have_attributes(to_template: '')) }
|
13
13
|
it { is_expected.to(have_attributes(changes: [])) }
|
14
|
-
|
14
|
+
|
15
|
+
it do
|
16
|
+
expect { includeschanger.user_defined_attribute }
|
17
|
+
.to(raise_error(NoMethodError))
|
18
|
+
end
|
15
19
|
end
|
16
20
|
|
17
21
|
describe '.from_config' do
|
@@ -22,7 +26,7 @@ RSpec.describe(DefMastership::RenameIncludedFilesLineModifier) do
|
|
22
26
|
)
|
23
27
|
end
|
24
28
|
|
25
|
-
it { is_expected.not_to(
|
29
|
+
it { is_expected.not_to(be_nil) }
|
26
30
|
it { is_expected.to(have_attributes(from_regexp: 'Whatever.+')) }
|
27
31
|
it { is_expected.to(have_attributes(to_template: 'Whatever')) }
|
28
32
|
end
|
@@ -18,7 +18,7 @@ RSpec.describe(DefMastership::RenameIncludedFilesModifier) do
|
|
18
18
|
end
|
19
19
|
|
20
20
|
describe '.new' do
|
21
|
-
it { is_expected.not_to(
|
21
|
+
it { is_expected.not_to(be_nil) }
|
22
22
|
it { is_expected.to(have_attributes(config: 'fake config')) }
|
23
23
|
it { is_expected.to(have_attributes(changes: [])) }
|
24
24
|
end
|
@@ -7,10 +7,14 @@ RSpec.describe(DefMastership::UpdateDefChecksumLineModifier) do
|
|
7
7
|
subject(:linemodifier) { described_class.new }
|
8
8
|
|
9
9
|
describe '.new' do
|
10
|
-
it { is_expected.not_to(
|
10
|
+
it { is_expected.not_to(be_nil) }
|
11
11
|
it { is_expected.to(have_attributes(def_type: '')) }
|
12
12
|
it { is_expected.to(have_attributes(changes: [])) }
|
13
|
-
|
13
|
+
|
14
|
+
it do
|
15
|
+
expect { linemodifier.user_defined_attribute }
|
16
|
+
.to(raise_error(NoMethodError))
|
17
|
+
end
|
14
18
|
end
|
15
19
|
|
16
20
|
describe '.from_config' do
|
@@ -20,7 +24,7 @@ RSpec.describe(DefMastership::UpdateDefChecksumLineModifier) do
|
|
20
24
|
)
|
21
25
|
end
|
22
26
|
|
23
|
-
it { is_expected.not_to(
|
27
|
+
it { is_expected.not_to(be_nil) }
|
24
28
|
it { is_expected.to(have_attributes(def_type: 'requirement')) }
|
25
29
|
it { is_expected.to(have_attributes(document: nil)) }
|
26
30
|
end
|
@@ -18,7 +18,7 @@ RSpec.describe(DefMastership::UpdateDefChecksumModifier) do
|
|
18
18
|
end
|
19
19
|
|
20
20
|
describe '.new' do
|
21
|
-
it { is_expected.not_to(
|
21
|
+
it { is_expected.not_to(be_nil) }
|
22
22
|
it { is_expected.to(have_attributes(config: 'fake config')) }
|
23
23
|
it { is_expected.to(have_attributes(changes: [])) }
|
24
24
|
end
|
@@ -7,10 +7,14 @@ RSpec.describe(DefMastership::UpdateDefVersionLineModifier) do
|
|
7
7
|
subject(:linemodifier) { described_class.new }
|
8
8
|
|
9
9
|
describe '.new' do
|
10
|
-
it { is_expected.not_to(
|
10
|
+
it { is_expected.not_to(be_nil) }
|
11
11
|
it { is_expected.to(have_attributes(def_type: '')) }
|
12
12
|
it { is_expected.to(have_attributes(changes: [])) }
|
13
|
-
|
13
|
+
|
14
|
+
it do
|
15
|
+
expect { linemodifier.user_defined_attribute }
|
16
|
+
.to(raise_error(NoMethodError))
|
17
|
+
end
|
14
18
|
end
|
15
19
|
|
16
20
|
describe '.from_config' do
|
@@ -21,7 +25,7 @@ RSpec.describe(DefMastership::UpdateDefVersionLineModifier) do
|
|
21
25
|
)
|
22
26
|
end
|
23
27
|
|
24
|
-
it { is_expected.not_to(
|
28
|
+
it { is_expected.not_to(be_nil) }
|
25
29
|
it { is_expected.to(have_attributes(def_type: 'requirement')) }
|
26
30
|
it { is_expected.to(have_attributes(first_version: 'a')) }
|
27
31
|
it { is_expected.to(have_attributes(document: nil)) }
|
@@ -18,7 +18,7 @@ RSpec.describe(DefMastership::UpdateDefVersionModifier) do
|
|
18
18
|
end
|
19
19
|
|
20
20
|
describe '.new' do
|
21
|
-
it { is_expected.not_to(
|
21
|
+
it { is_expected.not_to(be_nil) }
|
22
22
|
it { is_expected.to(have_attributes(config: { ref_document: 'ref.adoc' })) }
|
23
23
|
it { is_expected.to(have_attributes(changes: [])) }
|
24
24
|
end
|
@@ -30,7 +30,7 @@ RSpec.describe(DefMastership::UpdateDefVersionModifier) do
|
|
30
30
|
|
31
31
|
before do
|
32
32
|
allow(DefMastership::UpdateDefVersionLineModifier).to(
|
33
|
-
receive(:from_config).with(ref_document: 'ref.adoc').and_return(line_modifier)
|
33
|
+
receive(:from_config).with({ ref_document: 'ref.adoc' }).and_return(line_modifier)
|
34
34
|
)
|
35
35
|
allow(DefMastership::Document).to(receive(:new).and_return(document, ref_document))
|
36
36
|
allow(document).to(receive(:parse_file_with_preprocessor))
|
@@ -50,7 +50,7 @@ RSpec.describe(DefMastership::UpdateDefVersionModifier) do
|
|
50
50
|
|
51
51
|
it do
|
52
52
|
expect(DefMastership::UpdateDefVersionLineModifier).to(
|
53
|
-
have_received(:from_config).with(ref_document: 'ref.adoc')
|
53
|
+
have_received(:from_config).with({ ref_document: 'ref.adoc' })
|
54
54
|
)
|
55
55
|
end
|
56
56
|
|