defmastership 1.3.7 → 1.3.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/features/definition_version.feature +241 -0
- data/lib/defmastership/modifier/modifier_common.rb +1 -1
- data/lib/defmastership/modifier/update_def_version.rb +46 -8
- data/lib/defmastership/version.rb +1 -1
- data/spec/unit/defmastership/modifier/update_def_version_spec.rb +123 -0
- data/tasks/code_quality.rake +1 -2
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 12ede2830cace7dbc8665f7db780d2bb60acf8f5beb771b4ec9bfdb9fbd74c5b
|
|
4
|
+
data.tar.gz: 92010c0156be9e4c74f36789b4c269097d61d9bde4d87ccfa2fc1a8869aa4475
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 10b08062de66121b2a7785bb4a169ad8bf367566cd18dfad55d068324b8efa78075d8b6ec27362bf20256d306e73fd8f57a08e9d509ded3c415690cfd2f7ddb8
|
|
7
|
+
data.tar.gz: 27a73e65de9d300640b068dc4e4131bd0059e777cf4bcae2e1b0ea9d93d42795420e6e61c9678298ebb64aab3cbf33c6c9fda8218151e63709d0aa5d7cbf36ee
|
data/Gemfile
CHANGED
|
@@ -644,3 +644,244 @@ Feature: definitions version
|
|
|
644
644
|
Whatever: modified text.
|
|
645
645
|
--
|
|
646
646
|
"""
|
|
647
|
+
|
|
648
|
+
Scenario: Set forced explicit version when definition has changed and had a previous version
|
|
649
|
+
Given a file named "ref_doc.adoc" with:
|
|
650
|
+
"""
|
|
651
|
+
[define, requirement, TOTO-0001(3)]
|
|
652
|
+
--
|
|
653
|
+
initial text.
|
|
654
|
+
--
|
|
655
|
+
"""
|
|
656
|
+
Given a file named "thedoc.adoc" with:
|
|
657
|
+
"""
|
|
658
|
+
[define, requirement, TOTO-0001(whatever)]
|
|
659
|
+
--
|
|
660
|
+
modified text.
|
|
661
|
+
--
|
|
662
|
+
"""
|
|
663
|
+
And a file named "modifications.yml" with:
|
|
664
|
+
"""
|
|
665
|
+
---
|
|
666
|
+
:update_requirement_version:
|
|
667
|
+
:type: update_def_version
|
|
668
|
+
:config:
|
|
669
|
+
:def_type: requirement
|
|
670
|
+
:force_version: '42'
|
|
671
|
+
:ref_document: ./ref_doc.adoc
|
|
672
|
+
"""
|
|
673
|
+
When I successfully run `defmastership modify --modifications update_requirement_version thedoc.adoc`
|
|
674
|
+
And the stdout should not contain anything
|
|
675
|
+
Then the file "thedoc.adoc" should contain:
|
|
676
|
+
"""
|
|
677
|
+
[define, requirement, TOTO-0001(42)]
|
|
678
|
+
--
|
|
679
|
+
modified text.
|
|
680
|
+
--
|
|
681
|
+
"""
|
|
682
|
+
|
|
683
|
+
Scenario: Set forced explicit version when definition has changed and had no previous version
|
|
684
|
+
Given a file named "ref_doc.adoc" with:
|
|
685
|
+
"""
|
|
686
|
+
[define, requirement, TOTO-0001]
|
|
687
|
+
--
|
|
688
|
+
initial text.
|
|
689
|
+
--
|
|
690
|
+
"""
|
|
691
|
+
Given a file named "thedoc.adoc" with:
|
|
692
|
+
"""
|
|
693
|
+
[define, requirement, TOTO-0001(whatever)]
|
|
694
|
+
--
|
|
695
|
+
modified text.
|
|
696
|
+
--
|
|
697
|
+
"""
|
|
698
|
+
And a file named "modifications.yml" with:
|
|
699
|
+
"""
|
|
700
|
+
---
|
|
701
|
+
:update_requirement_version:
|
|
702
|
+
:type: update_def_version
|
|
703
|
+
:config:
|
|
704
|
+
:def_type: requirement
|
|
705
|
+
:force_version: '42'
|
|
706
|
+
:ref_document: ./ref_doc.adoc
|
|
707
|
+
"""
|
|
708
|
+
When I successfully run `defmastership modify --modifications update_requirement_version thedoc.adoc`
|
|
709
|
+
And the stdout should not contain anything
|
|
710
|
+
Then the file "thedoc.adoc" should contain:
|
|
711
|
+
"""
|
|
712
|
+
[define, requirement, TOTO-0001(42)]
|
|
713
|
+
--
|
|
714
|
+
modified text.
|
|
715
|
+
--
|
|
716
|
+
"""
|
|
717
|
+
|
|
718
|
+
Scenario: Do not set forced explicit version when definition has NOT changed and had a previous version
|
|
719
|
+
Given a file named "ref_doc.adoc" with:
|
|
720
|
+
"""
|
|
721
|
+
[define, requirement, TOTO-0001(3)]
|
|
722
|
+
--
|
|
723
|
+
initial text.
|
|
724
|
+
--
|
|
725
|
+
"""
|
|
726
|
+
Given a file named "thedoc.adoc" with:
|
|
727
|
+
"""
|
|
728
|
+
[define, requirement, TOTO-0001(whatever)]
|
|
729
|
+
--
|
|
730
|
+
initial text.
|
|
731
|
+
--
|
|
732
|
+
"""
|
|
733
|
+
And a file named "modifications.yml" with:
|
|
734
|
+
"""
|
|
735
|
+
---
|
|
736
|
+
:update_requirement_version:
|
|
737
|
+
:type: update_def_version
|
|
738
|
+
:config:
|
|
739
|
+
:def_type: requirement
|
|
740
|
+
:force_version: '42'
|
|
741
|
+
:ref_document: ./ref_doc.adoc
|
|
742
|
+
"""
|
|
743
|
+
When I successfully run `defmastership modify --modifications update_requirement_version thedoc.adoc`
|
|
744
|
+
And the stdout should not contain anything
|
|
745
|
+
Then the file "thedoc.adoc" should contain:
|
|
746
|
+
"""
|
|
747
|
+
[define, requirement, TOTO-0001(3)]
|
|
748
|
+
--
|
|
749
|
+
initial text.
|
|
750
|
+
--
|
|
751
|
+
"""
|
|
752
|
+
|
|
753
|
+
Scenario: Do not set forced explicit version when definition has NOT changed and had no previous version
|
|
754
|
+
Given a file named "ref_doc.adoc" with:
|
|
755
|
+
"""
|
|
756
|
+
[define, requirement, TOTO-0001]
|
|
757
|
+
--
|
|
758
|
+
initial text.
|
|
759
|
+
--
|
|
760
|
+
"""
|
|
761
|
+
Given a file named "thedoc.adoc" with:
|
|
762
|
+
"""
|
|
763
|
+
[define, requirement, TOTO-0001(whatever)]
|
|
764
|
+
--
|
|
765
|
+
initial text.
|
|
766
|
+
--
|
|
767
|
+
"""
|
|
768
|
+
And a file named "modifications.yml" with:
|
|
769
|
+
"""
|
|
770
|
+
---
|
|
771
|
+
:update_requirement_version:
|
|
772
|
+
:type: update_def_version
|
|
773
|
+
:config:
|
|
774
|
+
:def_type: requirement
|
|
775
|
+
:force_version: '42'
|
|
776
|
+
:ref_document: ./ref_doc.adoc
|
|
777
|
+
"""
|
|
778
|
+
When I successfully run `defmastership modify --modifications update_requirement_version thedoc.adoc`
|
|
779
|
+
And the stdout should not contain anything
|
|
780
|
+
Then the file "thedoc.adoc" should contain:
|
|
781
|
+
"""
|
|
782
|
+
[define, requirement, TOTO-0001]
|
|
783
|
+
--
|
|
784
|
+
initial text.
|
|
785
|
+
--
|
|
786
|
+
"""
|
|
787
|
+
|
|
788
|
+
Scenario: Generate an error when the definition has changed but the reference version is already equal to force_version
|
|
789
|
+
Given a file named "ref_doc.adoc" with:
|
|
790
|
+
"""
|
|
791
|
+
[define, requirement, TOTO-0001(42)]
|
|
792
|
+
--
|
|
793
|
+
initial text.
|
|
794
|
+
--
|
|
795
|
+
"""
|
|
796
|
+
Given a file named "thedoc.adoc" with:
|
|
797
|
+
"""
|
|
798
|
+
[define, requirement, TOTO-0001(whatever)]
|
|
799
|
+
--
|
|
800
|
+
modified text.
|
|
801
|
+
--
|
|
802
|
+
"""
|
|
803
|
+
And a file named "modifications.yml" with:
|
|
804
|
+
"""
|
|
805
|
+
---
|
|
806
|
+
:update_requirement_version:
|
|
807
|
+
:type: update_def_version
|
|
808
|
+
:config:
|
|
809
|
+
:def_type: requirement
|
|
810
|
+
:force_version: '42'
|
|
811
|
+
:ref_document: ./ref_doc.adoc
|
|
812
|
+
"""
|
|
813
|
+
When I run `defmastership modify --modifications update_requirement_version thedoc.adoc`
|
|
814
|
+
Then it should fail with:
|
|
815
|
+
"""
|
|
816
|
+
error: TOTO-0001 has changed but its version in reference document is already at force_version (42)
|
|
817
|
+
"""
|
|
818
|
+
|
|
819
|
+
Scenario: Do not set version when definition is new and first_version is configured
|
|
820
|
+
Given a file named "ref_doc.adoc" with:
|
|
821
|
+
"""
|
|
822
|
+
[define, requirement, TOTO-0002]
|
|
823
|
+
--
|
|
824
|
+
initial text.
|
|
825
|
+
--
|
|
826
|
+
"""
|
|
827
|
+
Given a file named "thedoc.adoc" with:
|
|
828
|
+
"""
|
|
829
|
+
[define, requirement, TOTO-0001]
|
|
830
|
+
--
|
|
831
|
+
modified text.
|
|
832
|
+
--
|
|
833
|
+
"""
|
|
834
|
+
And a file named "modifications.yml" with:
|
|
835
|
+
"""
|
|
836
|
+
---
|
|
837
|
+
:update_requirement_version:
|
|
838
|
+
:type: update_def_version
|
|
839
|
+
:config:
|
|
840
|
+
:def_type: requirement
|
|
841
|
+
:first_version: '1'
|
|
842
|
+
:ref_document: ./ref_doc.adoc
|
|
843
|
+
"""
|
|
844
|
+
When I successfully run `defmastership modify --modifications update_requirement_version thedoc.adoc`
|
|
845
|
+
And the stdout should not contain anything
|
|
846
|
+
Then the file "thedoc.adoc" should contain:
|
|
847
|
+
"""
|
|
848
|
+
[define, requirement, TOTO-0001]
|
|
849
|
+
--
|
|
850
|
+
modified text.
|
|
851
|
+
--
|
|
852
|
+
"""
|
|
853
|
+
|
|
854
|
+
Scenario: Set forced explicit version when definition is new and force_version is configured
|
|
855
|
+
Given a file named "ref_doc.adoc" with:
|
|
856
|
+
"""
|
|
857
|
+
[define, requirement, TOTO-0002]
|
|
858
|
+
--
|
|
859
|
+
initial text.
|
|
860
|
+
--
|
|
861
|
+
"""
|
|
862
|
+
Given a file named "thedoc.adoc" with:
|
|
863
|
+
"""
|
|
864
|
+
[define, requirement, TOTO-0001]
|
|
865
|
+
--
|
|
866
|
+
modified text.
|
|
867
|
+
--
|
|
868
|
+
"""
|
|
869
|
+
And a file named "modifications.yml" with:
|
|
870
|
+
"""
|
|
871
|
+
---
|
|
872
|
+
:update_requirement_version:
|
|
873
|
+
:type: update_def_version
|
|
874
|
+
:config:
|
|
875
|
+
:def_type: requirement
|
|
876
|
+
:force_version: '42'
|
|
877
|
+
:ref_document: ./ref_doc.adoc
|
|
878
|
+
"""
|
|
879
|
+
When I successfully run `defmastership modify --modifications update_requirement_version thedoc.adoc`
|
|
880
|
+
And the stdout should not contain anything
|
|
881
|
+
Then the file "thedoc.adoc" should contain:
|
|
882
|
+
"""
|
|
883
|
+
[define, requirement, TOTO-0001(42)]
|
|
884
|
+
--
|
|
885
|
+
modified text.
|
|
886
|
+
--
|
|
887
|
+
"""
|
|
@@ -15,7 +15,8 @@ module Defmastership
|
|
|
15
15
|
ref_document: [],
|
|
16
16
|
ref_tag: '',
|
|
17
17
|
ref_repo: '.',
|
|
18
|
-
first_version: ''
|
|
18
|
+
first_version: '',
|
|
19
|
+
force_version: ''
|
|
19
20
|
}
|
|
20
21
|
end
|
|
21
22
|
|
|
@@ -76,10 +77,16 @@ module Defmastership
|
|
|
76
77
|
|
|
77
78
|
def version_string(match)
|
|
78
79
|
ref_definition = Helper.def_from_match(@ref_document, match)
|
|
80
|
+
return force_version_for_new unless ref_definition
|
|
81
|
+
|
|
79
82
|
definition = Helper.def_from_match(document, match)
|
|
80
|
-
|
|
83
|
+
Helper.ref_version(ref_definition, definition, self)
|
|
84
|
+
end
|
|
81
85
|
|
|
82
|
-
|
|
86
|
+
# @return [String, nil] the forced version if configured and the definition is new
|
|
87
|
+
def force_version_for_new
|
|
88
|
+
forced = config.fetch(:force_version).to_s
|
|
89
|
+
forced unless forced.empty?
|
|
83
90
|
end
|
|
84
91
|
|
|
85
92
|
# Helper functions
|
|
@@ -113,13 +120,44 @@ module Defmastership
|
|
|
113
120
|
|
|
114
121
|
# @param ref_definition [Definition] the definition from the reference document
|
|
115
122
|
# @param definition [Definition] the definition from the current document
|
|
116
|
-
# @param
|
|
123
|
+
# @param modifier [UpdateDefVersion] the modifier configuration
|
|
117
124
|
# @return [String] the current definition version
|
|
118
|
-
def self.ref_version(ref_definition, definition,
|
|
119
|
-
|
|
120
|
-
return
|
|
125
|
+
def self.ref_version(ref_definition, definition, modifier)
|
|
126
|
+
ref_ver = ref_definition.explicit_version
|
|
127
|
+
return ref_ver if definition.sha256_short.eql?(ref_definition.sha256_short)
|
|
128
|
+
|
|
129
|
+
forced = modifier.config.fetch(:force_version).to_s
|
|
130
|
+
return next_or_first(ref_ver, modifier.first_version) if forced.empty?
|
|
131
|
+
|
|
132
|
+
check_and_return_forced(ref_definition, ref_ver, forced)
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
# @param explicit_version [String, nil] the explicit version from the reference document
|
|
136
|
+
# @param first_version [String] the first version
|
|
137
|
+
# @return [String] the selected version
|
|
138
|
+
def self.next_or_first(explicit_version, first_version)
|
|
139
|
+
explicit_version ? explicit_version.next : first_version
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
# @param ref_definition [Definition] the definition from the reference document
|
|
143
|
+
# @param ref_ver [String, nil] the explicit version from the reference document
|
|
144
|
+
# @param forced [String] the forced version
|
|
145
|
+
# @return [String] the forced version
|
|
146
|
+
def self.check_and_return_forced(ref_definition, ref_ver, forced)
|
|
147
|
+
raise_already_forced(ref_definition, forced) if ref_ver.eql?(forced)
|
|
121
148
|
|
|
122
|
-
|
|
149
|
+
forced
|
|
150
|
+
end
|
|
151
|
+
|
|
152
|
+
# @param ref_definition [Definition] the definition from the reference document
|
|
153
|
+
# @param force_version [String] forced version from configuration
|
|
154
|
+
def self.raise_already_forced(ref_definition, force_version)
|
|
155
|
+
raise(
|
|
156
|
+
ArgumentError,
|
|
157
|
+
"#{ref_definition.reference} has changed " \
|
|
158
|
+
'but its version in reference document is ' \
|
|
159
|
+
"already at force_version (#{force_version})"
|
|
160
|
+
)
|
|
123
161
|
end
|
|
124
162
|
|
|
125
163
|
# Make sure that ref_document configuration is an Array
|
|
@@ -12,6 +12,7 @@ RSpec.describe(Defmastership::Modifier::UpdateDefVersion) do
|
|
|
12
12
|
it { is_expected.to(have_attributes(def_type: '')) }
|
|
13
13
|
it { is_expected.to(have_attributes(ref_document: [])) }
|
|
14
14
|
it { is_expected.to(have_attributes(first_version: '')) }
|
|
15
|
+
it { is_expected.to(have_attributes(force_version: '')) }
|
|
15
16
|
end
|
|
16
17
|
|
|
17
18
|
describe '.replacement_methods' do
|
|
@@ -502,5 +503,127 @@ RSpec.describe(Defmastership::Modifier::UpdateDefVersion) do
|
|
|
502
503
|
end
|
|
503
504
|
end
|
|
504
505
|
end
|
|
506
|
+
|
|
507
|
+
context 'when force_version is provided' do
|
|
508
|
+
subject(:modifier) { described_class.new(def_type: 'requirement', force_version: '42') }
|
|
509
|
+
|
|
510
|
+
before do
|
|
511
|
+
allow(document).to(receive(:ref_to_def).with('REFERENCE').and_return(definition))
|
|
512
|
+
allow(definition).to(receive(:sha256_short).and_return(+'~abcd1234'))
|
|
513
|
+
end
|
|
514
|
+
|
|
515
|
+
context 'when definition has NOT changed' do
|
|
516
|
+
before do
|
|
517
|
+
allow(ref_document).to(receive(:ref_to_def).with('REFERENCE').and_return(ref_definition))
|
|
518
|
+
allow(ref_definition).to(receive(:sha256_short).and_return(+'~abcd1234'))
|
|
519
|
+
end
|
|
520
|
+
|
|
521
|
+
it 'retains the previous reference version if it had one' do
|
|
522
|
+
allow(ref_definition).to(receive(:explicit_version).and_return('3'))
|
|
523
|
+
expect(modifier.replace_reference('', '[define,requirement,REFERENCE]'))
|
|
524
|
+
.to(eq('[define,requirement,REFERENCE(3)]'))
|
|
525
|
+
end
|
|
526
|
+
|
|
527
|
+
it 'does not add a version if it had none' do
|
|
528
|
+
allow(ref_definition).to(receive(:explicit_version).and_return(nil))
|
|
529
|
+
expect(modifier.replace_reference('', '[define,requirement,REFERENCE]'))
|
|
530
|
+
.to(eq('[define,requirement,REFERENCE]'))
|
|
531
|
+
end
|
|
532
|
+
end
|
|
533
|
+
|
|
534
|
+
context 'when definition has changed' do
|
|
535
|
+
before do
|
|
536
|
+
allow(ref_document).to(receive(:ref_to_def).with('REFERENCE').and_return(ref_definition))
|
|
537
|
+
allow(ref_definition).to(receive_messages(sha256_short: +'~4321aaaa', reference: 'REFERENCE'))
|
|
538
|
+
end
|
|
539
|
+
|
|
540
|
+
it 'sets the version to the forced version if it had a previous version' do
|
|
541
|
+
allow(ref_definition).to(receive(:explicit_version).and_return('3'))
|
|
542
|
+
expect(modifier.replace_reference('', '[define,requirement,REFERENCE]'))
|
|
543
|
+
.to(eq('[define,requirement,REFERENCE(42)]'))
|
|
544
|
+
end
|
|
545
|
+
|
|
546
|
+
it 'sets the version to the forced version if it had no previous version' do
|
|
547
|
+
allow(ref_definition).to(receive(:explicit_version).and_return(nil))
|
|
548
|
+
expect(modifier.replace_reference('', '[define,requirement,REFERENCE]'))
|
|
549
|
+
.to(eq('[define,requirement,REFERENCE(42)]'))
|
|
550
|
+
end
|
|
551
|
+
|
|
552
|
+
it 'raises an error if the previous version is already equal to the forced version' do
|
|
553
|
+
allow(ref_definition).to(receive(:explicit_version).and_return('42'))
|
|
554
|
+
msg = 'REFERENCE has changed but its version in reference document is already at force_version (42)'
|
|
555
|
+
expect { modifier.replace_reference('', '[define,requirement,REFERENCE]') }
|
|
556
|
+
.to(raise_error(ArgumentError, msg))
|
|
557
|
+
end
|
|
558
|
+
end
|
|
559
|
+
|
|
560
|
+
context 'when definition is new' do
|
|
561
|
+
before do
|
|
562
|
+
allow(ref_document).to(receive(:ref_to_def).with('REFERENCE').and_return(nil))
|
|
563
|
+
end
|
|
564
|
+
|
|
565
|
+
it 'sets the version to the forced version' do
|
|
566
|
+
expect(modifier.replace_reference('', '[define,requirement,REFERENCE]'))
|
|
567
|
+
.to(eq('[define,requirement,REFERENCE(42)]'))
|
|
568
|
+
end
|
|
569
|
+
end
|
|
570
|
+
end
|
|
571
|
+
|
|
572
|
+
context 'when force_version is an integer' do
|
|
573
|
+
subject(:modifier) { described_class.new(def_type: 'requirement', force_version: 42) }
|
|
574
|
+
|
|
575
|
+
before do
|
|
576
|
+
allow(document).to(receive(:ref_to_def).with('REFERENCE').and_return(definition))
|
|
577
|
+
allow(definition).to(receive(:sha256_short).and_return(+'~abcd1234'))
|
|
578
|
+
end
|
|
579
|
+
|
|
580
|
+
context 'when definition is new' do
|
|
581
|
+
before do
|
|
582
|
+
allow(ref_document).to(receive(:ref_to_def).with('REFERENCE').and_return(nil))
|
|
583
|
+
end
|
|
584
|
+
|
|
585
|
+
it 'sets the version to the string representation' do
|
|
586
|
+
expect(modifier.replace_reference('', '[define,requirement,REFERENCE]'))
|
|
587
|
+
.to(eq('[define,requirement,REFERENCE(42)]'))
|
|
588
|
+
end
|
|
589
|
+
end
|
|
590
|
+
|
|
591
|
+
context 'when definition has changed' do
|
|
592
|
+
before do
|
|
593
|
+
allow(ref_document).to(receive(:ref_to_def).with('REFERENCE').and_return(ref_definition))
|
|
594
|
+
allow(ref_definition).to(receive_messages(sha256_short: +'~4321aaaa', reference: 'REFERENCE'))
|
|
595
|
+
end
|
|
596
|
+
|
|
597
|
+
it 'converts force_version to string' do
|
|
598
|
+
allow(ref_definition).to(receive(:explicit_version).and_return('3'))
|
|
599
|
+
expect(modifier.replace_reference('', '[define,requirement,REFERENCE]'))
|
|
600
|
+
.to(eq('[define,requirement,REFERENCE(42)]'))
|
|
601
|
+
end
|
|
602
|
+
end
|
|
603
|
+
end
|
|
604
|
+
|
|
605
|
+
context 'when force_version is nil' do
|
|
606
|
+
subject(:modifier) { described_class.new(def_type: 'requirement', force_version: nil) }
|
|
607
|
+
|
|
608
|
+
before do
|
|
609
|
+
allow(document).to(receive(:ref_to_def).with('REFERENCE').and_return(definition))
|
|
610
|
+
allow(definition).to(receive(:sha256_short).and_return(+'~abcd1234'))
|
|
611
|
+
allow(ref_document).to(receive(:ref_to_def).with('REFERENCE').and_return(nil))
|
|
612
|
+
end
|
|
613
|
+
|
|
614
|
+
it 'does not add a version if the definition is new' do
|
|
615
|
+
expect(modifier.replace_reference('', '[define,requirement,REFERENCE]'))
|
|
616
|
+
.to(eq('[define,requirement,REFERENCE]'))
|
|
617
|
+
end
|
|
618
|
+
end
|
|
619
|
+
|
|
620
|
+
context 'when force_version is missing from config' do
|
|
621
|
+
it 'raises a KeyError' do
|
|
622
|
+
obj = described_class.new(def_type: 'requirement')
|
|
623
|
+
allow(obj).to(receive(:config).and_return({}))
|
|
624
|
+
expect { obj.__send__(:force_version_for_new) }
|
|
625
|
+
.to(raise_error(KeyError))
|
|
626
|
+
end
|
|
627
|
+
end
|
|
505
628
|
end
|
|
506
629
|
end
|
data/tasks/code_quality.rake
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# Copyright (c) 2023 Jerome Arbez-Gindre
|
|
2
2
|
# frozen_string_literal: true
|
|
3
3
|
|
|
4
|
-
# rubocop:disable Metrics/BlockLength
|
|
4
|
+
# rubocop:disable-next Metrics/BlockLength
|
|
5
5
|
namespace 'quality' do
|
|
6
6
|
begin
|
|
7
7
|
require('rubocop/rake_task')
|
|
@@ -58,7 +58,6 @@ namespace 'quality' do
|
|
|
58
58
|
desc 'Runs all quality code check'
|
|
59
59
|
task(all: ['quality:rubocop', 'quality:reek', 'quality:flay'])
|
|
60
60
|
end
|
|
61
|
-
# rubocop:enable Metrics/BlockLength
|
|
62
61
|
|
|
63
62
|
desc 'Synonym for quality:rubocop'
|
|
64
63
|
task(rubocop: 'quality:rubocop')
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: defmastership
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.3.
|
|
4
|
+
version: 1.3.8
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Jérôme Arbez-Gindre
|
|
@@ -272,7 +272,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
272
272
|
- !ruby/object:Gem::Version
|
|
273
273
|
version: '0'
|
|
274
274
|
requirements: []
|
|
275
|
-
rubygems_version: 4.0.
|
|
275
|
+
rubygems_version: 4.0.21
|
|
276
276
|
specification_version: 4
|
|
277
277
|
summary: Handling of references and definitions with asciidoctor
|
|
278
278
|
test_files: []
|