mixlib-versioning 1.2.2 → 1.2.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. checksums.yaml +5 -5
  2. data/lib/mixlib/versioning.rb +1 -2
  3. data/lib/mixlib/versioning/exceptions.rb +1 -1
  4. data/lib/mixlib/versioning/format.rb +2 -3
  5. data/lib/mixlib/versioning/format/git_describe.rb +1 -1
  6. data/lib/mixlib/versioning/format/opscode_semver.rb +1 -1
  7. data/lib/mixlib/versioning/format/partial_semver.rb +1 -1
  8. data/lib/mixlib/versioning/format/rubygems.rb +1 -1
  9. data/lib/mixlib/versioning/format/semver.rb +1 -1
  10. data/lib/mixlib/versioning/version.rb +2 -2
  11. metadata +6 -53
  12. data/.expeditor/config.yml +0 -14
  13. data/.expeditor/update_version.sh +0 -9
  14. data/.github/CODEOWNERS +0 -3
  15. data/.gitignore +0 -21
  16. data/.travis.yml +0 -28
  17. data/CHANGELOG.md +0 -30
  18. data/Gemfile +0 -26
  19. data/README.md +0 -377
  20. data/Rakefile +0 -24
  21. data/VERSION +0 -1
  22. data/mixlib-versioning.gemspec +0 -20
  23. data/spec/mixlib/versioning/format/git_describe_spec.rb +0 -190
  24. data/spec/mixlib/versioning/format/opscode_semver_spec.rb +0 -138
  25. data/spec/mixlib/versioning/format/partial_semver_spec.rb +0 -121
  26. data/spec/mixlib/versioning/format/rubygems_spec.rb +0 -157
  27. data/spec/mixlib/versioning/format/semver_spec.rb +0 -128
  28. data/spec/mixlib/versioning/format_spec.rb +0 -88
  29. data/spec/mixlib/versioning/versioning_spec.rb +0 -281
  30. data/spec/spec_helper.rb +0 -42
  31. data/spec/support/shared_examples/basic_semver.rb +0 -40
  32. data/spec/support/shared_examples/behaviors/comparable.rb +0 -80
  33. data/spec/support/shared_examples/behaviors/comparable_types.rb +0 -56
  34. data/spec/support/shared_examples/behaviors/filterable.rb +0 -54
  35. data/spec/support/shared_examples/behaviors/parses_valid_version_strings.rb +0 -29
  36. data/spec/support/shared_examples/behaviors/rejects_invalid_version_strings.rb +0 -29
  37. data/spec/support/shared_examples/behaviors/serializable.rb +0 -49
  38. data/spec/support/shared_examples/behaviors/sortable.rb +0 -43
  39. data/spec/support/shared_examples/semver.rb +0 -117
@@ -1,157 +0,0 @@
1
- #
2
- # Author:: Seth Chisamore (<schisamo@chef.io>)
3
- # Copyright:: Copyright (c) 2013 Opscode, Inc.
4
- # License:: Apache License, Version 2.0
5
- #
6
- # Licensed under the Apache License, Version 2.0 (the "License");
7
- # you may not use this file except in compliance with the License.
8
- # You may obtain a copy of the License at
9
- #
10
- # http://www.apache.org/licenses/LICENSE-2.0
11
- #
12
- # Unless required by applicable law or agreed to in writing, software
13
- # distributed under the License is distributed on an "AS IS" BASIS,
14
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
- # See the License for the specific language governing permissions and
16
- # limitations under the License.
17
- #
18
-
19
- require "spec_helper"
20
-
21
- describe Mixlib::Versioning::Format::Rubygems do
22
- subject { described_class.new(version_string) }
23
-
24
- it_should_behave_like "Basic SemVer"
25
-
26
- it_has_behavior "parses valid version strings", {
27
- "10.1.1" => {
28
- major: 10,
29
- minor: 1,
30
- patch: 1,
31
- prerelease: nil,
32
- build: nil,
33
- release?: true,
34
- prerelease?: false,
35
- build?: false,
36
- release_build?: false,
37
- prerelease_build?: false,
38
- iteration: nil,
39
- },
40
- "10.1.1.alpha.1" => {
41
- major: 10,
42
- minor: 1,
43
- patch: 1,
44
- prerelease: "alpha.1",
45
- build: nil,
46
- release?: false,
47
- prerelease?: true,
48
- build?: false,
49
- release_build?: false,
50
- prerelease_build?: false,
51
- iteration: nil,
52
- },
53
- "11.0.8.rc.3" => {
54
- major: 11,
55
- minor: 0,
56
- patch: 8,
57
- prerelease: "rc.3",
58
- build: nil,
59
- release?: false,
60
- prerelease?: true,
61
- build?: false,
62
- release_build?: false,
63
- prerelease_build?: false,
64
- iteration: nil,
65
- },
66
- "11.0.8-33" => {
67
- major: 11,
68
- minor: 0,
69
- patch: 8,
70
- prerelease: nil,
71
- build: nil,
72
- release?: true,
73
- prerelease?: false,
74
- build?: false,
75
- release_build?: false,
76
- prerelease_build?: false,
77
- iteration: 33,
78
- },
79
- "11.0.8.rc.3-1" => {
80
- major: 11,
81
- minor: 0,
82
- patch: 8,
83
- prerelease: "rc.3",
84
- build: nil,
85
- release?: false,
86
- prerelease?: true,
87
- build?: false,
88
- release_build?: false,
89
- prerelease_build?: false,
90
- iteration: 1,
91
- },
92
- }
93
-
94
- it_has_behavior "rejects invalid version strings", {
95
- "1.1.1-rutro" => "dash for pre-release delimeter",
96
- }
97
-
98
- it_has_behavior "serializable", [
99
- "1.0.0",
100
- "1.0.0.alpha.1",
101
- "1.0.0.beta",
102
- ]
103
-
104
- it_has_behavior "sortable" do
105
- let(:unsorted_version_strings) do
106
- %w{
107
- 1.0.0.beta.2
108
- 1.3.7.alpha.0
109
- 1.0.0.alpha
110
- 1.0.0.rc.1
111
- 1.0.0
112
- }
113
- end
114
- let(:sorted_version_strings) do
115
- %w{
116
- 1.0.0.alpha
117
- 1.0.0.beta.2
118
- 1.0.0.rc.1
119
- 1.0.0
120
- 1.3.7.alpha.0
121
- }
122
- end
123
- let(:min) { "1.0.0.alpha" }
124
- let(:max) { "1.3.7.alpha.0" }
125
- end
126
-
127
- # The +Rubygems+ format only produces release and prerelease versions.
128
- it_has_behavior "filterable" do
129
- let(:unsorted_version_strings) do
130
- %w{
131
- 1.0.0.beta.2
132
- 1.3.7.alpha.0
133
- 1.0.0.alpha
134
- 1.0.0.rc.1
135
- 1.0.0
136
- }
137
- end
138
- let(:release_versions) { %w{1.0.0} }
139
- let(:prerelease_versions) do
140
- %w{
141
- 1.0.0.beta.2
142
- 1.3.7.alpha.0
143
- 1.0.0.alpha
144
- 1.0.0.rc.1
145
- }
146
- end
147
- end
148
-
149
- it_has_behavior "comparable", [
150
- "0.1.0", "0.2.0",
151
- "1.0.0.alpha.1", "1.0.0",
152
- "1.2.3.alpha", "1.2.3.alpha.1",
153
- "2.4.5.alpha", "2.4.5.beta",
154
- "3.0.0.beta.1", "3.0.0.rc.1",
155
- "3.1.2.rc.42", "3.1.2"
156
- ]
157
- end
@@ -1,128 +0,0 @@
1
- #
2
- # Author:: Seth Chisamore (<schisamo@chef.io>)
3
- # Copyright:: Copyright (c) 2013 Opscode, Inc.
4
- # License:: Apache License, Version 2.0
5
- #
6
- # Licensed under the Apache License, Version 2.0 (the "License");
7
- # you may not use this file except in compliance with the License.
8
- # You may obtain a copy of the License at
9
- #
10
- # http://www.apache.org/licenses/LICENSE-2.0
11
- #
12
- # Unless required by applicable law or agreed to in writing, software
13
- # distributed under the License is distributed on an "AS IS" BASIS,
14
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
- # See the License for the specific language governing permissions and
16
- # limitations under the License.
17
- #
18
-
19
- require "spec_helper"
20
-
21
- describe Mixlib::Versioning::Format::SemVer do
22
- subject { described_class.new(version_string) }
23
-
24
- it_should_behave_like Mixlib::Versioning::Format::SemVer
25
-
26
- it_has_behavior "serializable", [
27
- "1.0.0",
28
- "1.0.0-alpha.1",
29
- "1.0.0-alpha.1+some.build.version",
30
- "1.0.0+build.build.build",
31
- ]
32
-
33
- it_has_behavior "sortable" do
34
- let(:unsorted_version_strings) do
35
- %w{
36
- 1.0.0-beta.2
37
- 1.0.0-alpha
38
- 1.0.0-alpha.july
39
- 1.0.0-rc.1+build.1
40
- 1.0.0
41
- 1.0.0-beta.11
42
- 1.0.0+0.3.7
43
- 1.0.0-rc.1
44
- 1.0.0-alpha.1
45
- 1.3.7+build.2.b8f12d7
46
- 1.3.7+build.11.e0f985a
47
- 1.3.7+build
48
- }
49
- end
50
- let(:sorted_version_strings) do
51
- %w{
52
- 1.0.0-alpha
53
- 1.0.0-alpha.1
54
- 1.0.0-alpha.july
55
- 1.0.0-beta.2
56
- 1.0.0-beta.11
57
- 1.0.0-rc.1
58
- 1.0.0-rc.1+build.1
59
- 1.0.0
60
- 1.0.0+0.3.7
61
- 1.3.7+build
62
- 1.3.7+build.2.b8f12d7
63
- 1.3.7+build.11.e0f985a
64
- }
65
- end
66
- let(:min) { "1.0.0-alpha" }
67
- let(:max) { "1.3.7+build.11.e0f985a" }
68
- end # it_has_behavior
69
-
70
- it_has_behavior "filterable" do
71
- let(:unsorted_version_strings) do
72
- %w{
73
- 1.0.0-beta.2
74
- 1.0.0-alpha
75
- 1.0.0-rc.1+build.1
76
- 1.0.0
77
- 1.0.0-beta.11
78
- 1.0.0+0.3.7
79
- 1.0.0-rc.1
80
- 1.0.0-alpha.1
81
- 1.3.7+build.2.b8f12d7
82
- 1.3.7+build.11.e0f985a
83
- 1.3.7+build
84
- }
85
- end
86
- let(:release_versions) do
87
- %w{
88
- 1.0.0 }
89
- end
90
- let(:prerelease_versions) do
91
- %w{
92
- 1.0.0-beta.2
93
- 1.0.0-alpha
94
- 1.0.0-beta.11
95
- 1.0.0-rc.1
96
- 1.0.0-alpha.1
97
- }
98
- end
99
- let(:build_versions) do
100
- %w{
101
- 1.0.0-rc.1+build.1
102
- 1.0.0+0.3.7
103
- 1.3.7+build.2.b8f12d7
104
- 1.3.7+build.11.e0f985a
105
- 1.3.7+build
106
- }
107
- end
108
- let(:release_build_versions) do
109
- %w{
110
- 1.0.0+0.3.7
111
- 1.3.7+build.2.b8f12d7
112
- 1.3.7+build.11.e0f985a
113
- 1.3.7+build
114
- }
115
- end
116
- let(:prerelease_build_versions) do
117
- %w{
118
- 1.0.0-rc.1+build.1 }
119
- end
120
- end # it_has_behavior
121
-
122
- it_has_behavior "comparable", [
123
- "0.1.0", "0.2.0",
124
- "1.0.0-alpha.1", "1.0.0",
125
- "1.2.3", "1.2.3+build.123",
126
- "2.0.0-beta.1", "2.0.0-beta.1+build.123"
127
- ]
128
- end # describe
@@ -1,88 +0,0 @@
1
- #
2
- # Author:: Seth Chisamore (<schisamo@chef.io>)
3
- # Author:: Ryan Hass (<rhass@chef.io>)
4
- # Copyright:: Copyright (c) 2013 Opscode, Inc.
5
- # Copyright:: Copyright (c) 2017 Chef Software Inc.
6
- # License:: Apache License, Version 2.0
7
- #
8
- # Licensed under the Apache License, Version 2.0 (the "License");
9
- # you may not use this file except in compliance with the License.
10
- # You may obtain a copy of the License at
11
- #
12
- # http://www.apache.org/licenses/LICENSE-2.0
13
- #
14
- # Unless required by applicable law or agreed to in writing, software
15
- # distributed under the License is distributed on an "AS IS" BASIS,
16
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
- # See the License for the specific language governing permissions and
18
- # limitations under the License.
19
- #
20
-
21
- require "spec_helper"
22
-
23
- describe Mixlib::Versioning::Format do
24
- describe "#initialize" do
25
- subject { described_class.new(version_string) }
26
- let(:version_string) { "11.0.0" }
27
-
28
- it "descendants must override #parse" do
29
- expect { subject }.to raise_error(StandardError)
30
- end
31
- end
32
-
33
- describe ".for" do
34
- subject { described_class }
35
-
36
- [
37
- :rubygems,
38
- "rubygems",
39
- Mixlib::Versioning::Format::Rubygems,
40
- ].each do |format_type|
41
- context 'format_type is a: #{format_type.class}' do
42
- let(:format_type) { format_type }
43
- it "returns the correct format class" do
44
- expect(subject.for(format_type)).to eq Mixlib::Versioning::Format::Rubygems
45
- end # it
46
- end # context
47
- end # each
48
-
49
- describe "unknown format_type" do
50
- [
51
- :poop,
52
- "poop",
53
- Mixlib::Versioning,
54
- ].each do |invalid_format_type|
55
- context 'format_type is a: #{invalid_format_type.class}' do
56
- it "raises a Mixlib::Versioning::UnknownFormatError" do
57
- expect { subject.for(invalid_format_type) }.to raise_error(Mixlib::Versioning::UnknownFormatError)
58
- end # it
59
- end # context
60
- end # each
61
- end # describe
62
- end # describe ".for"
63
- end # describe Mixlib::Versioning::Format
64
-
65
- describe Mixlib::Versioning do
66
- versions = [
67
- "1", "1.0.0",
68
- "1.2", "1.2.0"
69
- ]
70
-
71
- describe "#==" do
72
- formats = described_class::DEFAULT_FORMATS.select do |klass|
73
- unless klass.name == "Mixlib::Versioning::Format::PartialSemVer" || klass.name == "Mixlib::Versioning::Format::GitDescribe"
74
- klass
75
- end
76
- end
77
-
78
- formats.each do |format|
79
- context "#{format}" do
80
- versions.each_slice(2) do |a, b|
81
- it "parsed value #{a} is equal to #{format} parsed value #{b}" do
82
- expect(described_class.parse(a) == format.new(b)).to be true
83
- end
84
- end
85
- end # context
86
- end # formats.each
87
- end # describe "#=="
88
- end # describe Mixlib::Version
@@ -1,281 +0,0 @@
1
- #
2
- # Author:: Seth Chisamore (<schisamo@chef.io>)
3
- # Copyright:: Copyright (c) 2013 Opscode, Inc.
4
- # License:: Apache License, Version 2.0
5
- #
6
- # Licensed under the Apache License, Version 2.0 (the "License");
7
- # you may not use this file except in compliance with the License.
8
- # You may obtain a copy of the License at
9
- #
10
- # http://www.apache.org/licenses/LICENSE-2.0
11
- #
12
- # Unless required by applicable law or agreed to in writing, software
13
- # distributed under the License is distributed on an "AS IS" BASIS,
14
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
- # See the License for the specific language governing permissions and
16
- # limitations under the License.
17
- #
18
-
19
- require "spec_helper"
20
-
21
- describe Mixlib::Versioning do
22
- subject { described_class }
23
-
24
- let(:version_string) { "11.0.0" }
25
-
26
- describe ".parse" do
27
- describe "parsing when format type is specified" do
28
- {
29
- "11.0.8" => {
30
- format_type: :semver,
31
- expected_format: Mixlib::Versioning::Format::SemVer,
32
- },
33
- "11.1.1" => {
34
- format_type: :rubygems,
35
- expected_format: Mixlib::Versioning::Format::Rubygems,
36
- },
37
- "11.1.1.alpha.1" => {
38
- format_type: :rubygems,
39
- expected_format: Mixlib::Versioning::Format::Rubygems,
40
- },
41
- "11.1.1-alpha.1" => {
42
- format_type: :opscode_semver,
43
- expected_format: Mixlib::Versioning::Format::OpscodeSemVer,
44
- },
45
- "11.1.1-rc.2" => {
46
- format_type: :opscode_semver,
47
- expected_format: Mixlib::Versioning::Format::SemVer,
48
- },
49
- }.each_pair do |version_string, options|
50
- context "#{version_string} as #{options[:expected_format]}" do
51
- let(:version_string) { version_string }
52
- let(:expected_format) { options[:expected_format] }
53
-
54
- [
55
- options[:format_type],
56
- options[:format_type].to_s,
57
- options[:expected_format],
58
- ].each do |format_type|
59
- context "format type as a: #{format_type.class}" do
60
- it "parses version string as: #{options[:expected_format]}" do
61
- result = subject.parse(version_string, format_type)
62
- expect(result).to be_a(expected_format)
63
- end # it
64
- end # context
65
- end # each
66
- end # context
67
- end # each_pair
68
-
69
- describe "invalid format type specified" do
70
- [
71
- :poop,
72
- "poop",
73
- Mixlib::Versioning,
74
- ].each do |invalid_format_type|
75
- context "invalid format as a: #{invalid_format_type.class}" do
76
- it "raises a Mixlib::Versioning::UnknownFormatError" do
77
- expect { subject.parse(version_string, invalid_format_type) }.to raise_error(Mixlib::Versioning::UnknownFormatError)
78
- end # it
79
- end # context
80
- end # each
81
- end # describe
82
- end # describe
83
-
84
- describe "parsing with automatic format detection" do
85
- {
86
- "11.0.8" => Mixlib::Versioning::Format::SemVer,
87
- "11.0.8-1" => Mixlib::Versioning::Format::SemVer,
88
- "11.0.8.rc.1" => Mixlib::Versioning::Format::Rubygems,
89
- "11.0.8.rc.1-1" => Mixlib::Versioning::Format::Rubygems,
90
- "11.0.8-rc.1" => Mixlib::Versioning::Format::OpscodeSemVer,
91
-
92
- "10.18.2" => Mixlib::Versioning::Format::SemVer,
93
- "10.18.2-poop" => Mixlib::Versioning::Format::SemVer,
94
- "10.18.2.poop" => Mixlib::Versioning::Format::Rubygems,
95
- "10.18.2.poop-1" => Mixlib::Versioning::Format::Rubygems,
96
-
97
- "12.1.1+20130311134422" => Mixlib::Versioning::Format::OpscodeSemVer,
98
- "12.1.1-rc.3+20130311134422" => Mixlib::Versioning::Format::OpscodeSemVer,
99
- "12.1.1+20130308110833.git.2.94a1dde" => Mixlib::Versioning::Format::OpscodeSemVer,
100
-
101
- "10.16.2-49-g21353f0" => Mixlib::Versioning::Format::GitDescribe,
102
- "10.16.2-49-g21353f0-1" => Mixlib::Versioning::Format::GitDescribe,
103
- "10.16.2.rc.2-49-g21353f0" => Mixlib::Versioning::Format::GitDescribe,
104
- "10.16.2-rc.2-49-g21353f0" => Mixlib::Versioning::Format::GitDescribe,
105
- }.each_pair do |version_string, expected_format|
106
- context version_string do
107
- let(:version_string) { version_string }
108
- it "parses version string as: #{expected_format}" do
109
- expect(subject.parse(version_string)).to be_a(expected_format)
110
- end # it
111
- end # context
112
- end # each_pair
113
-
114
- describe "version_string cannot be parsed" do
115
- let(:version_string) { "A.B.C" }
116
- it "returns nil" do
117
- expect(subject.parse(version_string)).to be_nil
118
- end
119
- end
120
- end # describe "parsing with automatic format detection"
121
-
122
- describe "parsing an Mixlib::Versioning::Format object" do
123
- it "returns the same object" do
124
- v = Mixlib::Versioning.parse(version_string)
125
- result = subject.parse(v)
126
- expect(v).to be result
127
- end
128
- end
129
-
130
- describe "when formats are given" do
131
- context "when the format is not in the list" do
132
- let(:version_string) { "10.16.2-rc.2-49-g21353f0" }
133
- it "returns nil when the array contains a Mixlib::Versioning::Format" do
134
- expect(subject.parse(version_string, [Mixlib::Versioning::Format::Rubygems])).to be_nil
135
- end
136
-
137
- it "returns nil when the array contains a string" do
138
- expect(subject.parse(version_string, ["rubygems"])).to be_nil
139
- end
140
-
141
- it "returns nil when the array contains a symbol" do
142
- expect(subject.parse(version_string, [:rubygems])).to be_nil
143
- end
144
- end
145
-
146
- context "when the format is in the list" do
147
- let(:version_string) { "10.16.2-rc.2-49-g21353f0" }
148
- let(:expected_format) { Mixlib::Versioning::Format::GitDescribe }
149
- it "returns nil when the array contains a Mixlib::Versioning::Format" do
150
- expect(subject.parse(version_string, [expected_format])).to be_a(expected_format)
151
- end
152
-
153
- it "returns nil when the array contains a string" do
154
- expect(subject.parse(version_string, ["git_describe"])).to be_a(expected_format)
155
- end
156
-
157
- it "returns nil when the array contains a symbol" do
158
- expect(subject.parse(version_string, [:git_describe])).to be_a(expected_format)
159
- end
160
- end
161
- end
162
- end # describe .parse
163
-
164
- describe ".find_target_version" do
165
- let(:all_versions) do
166
- %w{
167
- 11.0.0-beta.1
168
- 11.0.0-rc.1
169
- 11.0.0
170
- 11.0.1
171
- 11.0.1+2013031116332
172
- 11.0.2-alpha.0
173
- 11.0.2-alpha.0+2013041116332
174
- 11.0.2
175
- }
176
- end
177
- let(:filter_version) { nil }
178
- let(:use_prerelease_versions) { false }
179
- let(:use_build_versions) { false }
180
- let(:subject_find) do
181
- subject.find_target_version(
182
- all_versions,
183
- filter_version,
184
- use_prerelease_versions,
185
- use_build_versions
186
- )
187
- end
188
-
189
- {
190
- nil => {
191
- releases_only: "11.0.2",
192
- prerelease_versions: "11.0.2-alpha.0",
193
- build_versions: "11.0.1+2013031116332",
194
- prerelease_and_build_versions: "11.0.2-alpha.0+2013041116332",
195
- },
196
- "11.0.0" => {
197
- releases_only: "11.0.0",
198
- prerelease_versions: "11.0.0-rc.1",
199
- build_versions: nil,
200
- prerelease_and_build_versions: nil,
201
- },
202
- "11.0.2" => {
203
- releases_only: "11.0.2",
204
- prerelease_versions: "11.0.2-alpha.0",
205
- build_versions: nil,
206
- prerelease_and_build_versions: "11.0.2-alpha.0+2013041116332",
207
- },
208
- "11.0.2" => { # rubocop: disable Lint/DuplicatedKey
209
- releases_only: "11.0.2",
210
- prerelease_versions: "11.0.2-alpha.0",
211
- build_versions: nil,
212
- prerelease_and_build_versions: "11.0.2-alpha.0+2013041116332",
213
- },
214
- "11.0.2-alpha.0" => {
215
- releases_only: "11.0.2-alpha.0",
216
- prerelease_versions: "11.0.2-alpha.0",
217
- build_versions: "11.0.2-alpha.0+2013041116332",
218
- prerelease_and_build_versions: "11.0.2-alpha.0+2013041116332",
219
- },
220
- }.each_pair do |filter_version, options|
221
- context "filter version of: #{filter_version}" do
222
- let(:filter_version) { filter_version }
223
- let(:expected_version) { options[:releases_only] }
224
-
225
- it "finds the most recent release version" do
226
- expect(subject_find).to eq Mixlib::Versioning.parse(expected_version)
227
- end
228
-
229
- context "include pre-release versions" do
230
- let(:use_prerelease_versions) { true }
231
- let(:expected_version) { options[:prerelease_versions] }
232
-
233
- it "finds the most recent pre-release version" do
234
- expect(subject_find).to eq Mixlib::Versioning.parse(expected_version)
235
- end # it
236
- end # context
237
-
238
- context "include build versions" do
239
- let(:use_build_versions) { true }
240
- let(:expected_version) { options[:build_versions] }
241
-
242
- it "finds the most recent build version" do
243
- expect(subject_find).to eq Mixlib::Versioning.parse(expected_version)
244
- end # it
245
- end # context
246
-
247
- context "include pre-release and build versions" do
248
- let(:use_prerelease_versions) { true }
249
- let(:use_build_versions) { true }
250
- let(:expected_version) { options[:prerelease_and_build_versions] }
251
-
252
- it "finds the most recent pre-release build version" do
253
- expect(subject_find).to eq Mixlib::Versioning.parse(expected_version)
254
- end # it
255
- end # context
256
- end # context
257
- end # each_pair
258
-
259
- describe "all_versions argument is a mix of String and Mixlib::Versioning::Format instances" do
260
- let(:all_versions) do
261
- [
262
- "11.0.0-beta.1",
263
- "11.0.0-rc.1",
264
- Mixlib::Versioning.parse("11.0.0"),
265
- ]
266
- end
267
-
268
- it "correctly parses the array" do
269
- expect(subject_find).to eq Mixlib::Versioning.parse("11.0.0")
270
- end
271
- end # describe
272
-
273
- describe "filter_version argument is an instance of Mixlib::Versioning::Format" do
274
- let(:filter_version) { Mixlib::Versioning::Format::SemVer.new("11.0.0") }
275
-
276
- it "finds the correct version" do
277
- expect(subject_find).to eq Mixlib::Versioning.parse("11.0.0")
278
- end
279
- end
280
- end # describe
281
- end # describe Mixlib::Versioning