mixlib-versioning 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (35) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +2 -0
  3. data/.rubocop.yml +22 -0
  4. data/.travis.yml +24 -0
  5. data/CHANGELOG.md +16 -1
  6. data/Gemfile +3 -4
  7. data/README.md +9 -15
  8. data/Rakefile +15 -3
  9. data/lib/mixlib/versioning.rb +32 -29
  10. data/lib/mixlib/versioning/exceptions.rb +1 -1
  11. data/lib/mixlib/versioning/format.rb +33 -31
  12. data/lib/mixlib/versioning/format/git_describe.rb +5 -7
  13. data/lib/mixlib/versioning/format/opscode_semver.rb +6 -17
  14. data/lib/mixlib/versioning/format/rubygems.rb +6 -8
  15. data/lib/mixlib/versioning/format/semver.rb +9 -11
  16. data/lib/mixlib/versioning/version.rb +2 -2
  17. data/mixlib-versioning.gemspec +20 -14
  18. data/spec/mixlib/versioning/format/git_describe_spec.rb +143 -131
  19. data/spec/mixlib/versioning/format/opscode_semver_spec.rb +106 -81
  20. data/spec/mixlib/versioning/format/rubygems_spec.rb +119 -104
  21. data/spec/mixlib/versioning/format/semver_spec.rb +98 -77
  22. data/spec/mixlib/versioning/format_spec.rb +17 -25
  23. data/spec/mixlib/versioning/versioning_spec.rb +163 -141
  24. data/spec/spec_helper.rb +2 -2
  25. data/spec/support/shared_examples/basic_semver.rb +19 -21
  26. data/spec/support/shared_examples/behaviors/comparable.rb +80 -0
  27. data/spec/support/shared_examples/behaviors/filterable.rb +19 -31
  28. data/spec/support/shared_examples/behaviors/parses_valid_version_strings.rb +4 -7
  29. data/spec/support/shared_examples/behaviors/rejects_invalid_version_strings.rb +3 -6
  30. data/spec/support/shared_examples/behaviors/serializable.rb +5 -7
  31. data/spec/support/shared_examples/behaviors/sortable.rb +7 -9
  32. data/spec/support/shared_examples/semver.rb +81 -69
  33. metadata +51 -26
  34. data/.yardopts +0 -7
  35. data/CONTRIBUTING.md +0 -188
@@ -1,5 +1,5 @@
1
1
  #
2
- # Author:: Seth Chisamore (<schisamo@opscode.com>)
2
+ # Author:: Seth Chisamore (<schisamo@chef.io>)
3
3
  # Copyright:: Copyright (c) 2013 Opscode, Inc.
4
4
  # License:: Apache License, Version 2.0
5
5
  #
@@ -19,89 +19,110 @@
19
19
  require 'spec_helper'
20
20
 
21
21
  describe Mixlib::Versioning::Format::SemVer do
22
-
23
- subject{ described_class.new(version_string) }
22
+ subject { described_class.new(version_string) }
24
23
 
25
24
  it_should_behave_like Mixlib::Versioning::Format::SemVer
26
25
 
27
- it_has_behavior "serializable", [
28
- "1.0.0",
29
- "1.0.0-alpha.1",
30
- "1.0.0-alpha.1+some.build.version",
31
- "1.0.0+build.build.build"
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',
32
31
  ]
33
32
 
34
- it_has_behavior "sortable" do
35
- let(:unsorted_version_strings){%w{
36
- 1.0.0-beta.2
37
- 1.0.0-alpha
38
- 1.0.0-rc.1+build.1
39
- 1.0.0
40
- 1.0.0-beta.11
41
- 1.0.0+0.3.7
42
- 1.0.0-rc.1
43
- 1.0.0-alpha.1
44
- 1.3.7+build.2.b8f12d7
45
- 1.3.7+build.11.e0f985a
46
- 1.3.7+build
47
- }}
48
- let(:sorted_version_strings){%w{
49
- 1.0.0-alpha
50
- 1.0.0-alpha.1
51
- 1.0.0-beta.2
52
- 1.0.0-beta.11
53
- 1.0.0-rc.1
54
- 1.0.0-rc.1+build.1
55
- 1.0.0
56
- 1.0.0+0.3.7
57
- 1.3.7+build
58
- 1.3.7+build.2.b8f12d7
59
- 1.3.7+build.11.e0f985a
60
- }}
61
- let(:min){ "1.0.0-alpha" }
62
- let(:max){ "1.3.7+build.11.e0f985a" }
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' }
63
68
  end # it_has_behavior
64
69
 
65
- it_has_behavior "filterable" do
66
- let(:unsorted_version_strings){%w{
67
- 1.0.0-beta.2
68
- 1.0.0-alpha
69
- 1.0.0-rc.1+build.1
70
- 1.0.0
71
- 1.0.0-beta.11
72
- 1.0.0+0.3.7
73
- 1.0.0-rc.1
74
- 1.0.0-alpha.1
75
- 1.3.7+build.2.b8f12d7
76
- 1.3.7+build.11.e0f985a
77
- 1.3.7+build
78
- }}
79
- let(:release_versions){%w{
80
- 1.0.0
81
- }}
82
- let(:prerelease_versions){%w{
83
- 1.0.0-beta.2
84
- 1.0.0-alpha
85
- 1.0.0-beta.11
86
- 1.0.0-rc.1
87
- 1.0.0-alpha.1
88
- }}
89
- let(:build_versions){%w{
90
- 1.0.0-rc.1+build.1
91
- 1.0.0+0.3.7
92
- 1.3.7+build.2.b8f12d7
93
- 1.3.7+build.11.e0f985a
94
- 1.3.7+build
95
- }}
96
- let(:release_build_versions){%w{
97
- 1.0.0+0.3.7
98
- 1.3.7+build.2.b8f12d7
99
- 1.3.7+build.11.e0f985a
100
- 1.3.7+build
101
- }}
102
- let(:prerelease_build_versions){%w{
103
- 1.0.0-rc.1+build.1
104
- }}
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
105
120
  end # it_has_behavior
106
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
+ ]
107
128
  end # describe
@@ -1,5 +1,5 @@
1
1
  #
2
- # Author:: Seth Chisamore (<schisamo@opscode.com>)
2
+ # Author:: Seth Chisamore (<schisamo@chef.io>)
3
3
  # Copyright:: Copyright (c) 2013 Opscode, Inc.
4
4
  # License:: Apache License, Version 2.0
5
5
  #
@@ -19,51 +19,43 @@
19
19
  require 'spec_helper'
20
20
 
21
21
  describe Mixlib::Versioning::Format do
22
+ describe '#initialize' do
23
+ subject { described_class.new(version_string) }
24
+ let(:version_string) { '11.0.0' }
22
25
 
23
- describe "#initialize" do
24
- subject{ described_class.new(version_string) }
25
- let(:version_string) { "11.0.0" }
26
-
27
- it "descendants must override #parse" do
26
+ it 'descendants must override #parse' do
28
27
  expect { subject }.to raise_error
29
28
  end
30
29
  end
31
30
 
32
- describe ".for" do
33
-
34
- subject{ described_class }
31
+ describe '.for' do
32
+ subject { described_class }
35
33
 
36
34
  [
37
35
  :rubygems,
38
- "rubygems",
39
- Mixlib::Versioning::Format::Rubygems
36
+ 'rubygems',
37
+ Mixlib::Versioning::Format::Rubygems,
40
38
  ].each do |format_type|
41
-
42
- context "format_type is a: #{format_type.class}" do
43
- let(:format_type){ format_type }
44
- it "returns the correct format class" do
39
+ context 'format_type is a: #{format_type.class}' do
40
+ let(:format_type) { format_type }
41
+ it 'returns the correct format class' do
45
42
  subject.for(format_type).should eq Mixlib::Versioning::Format::Rubygems
46
43
  end # it
47
44
  end # context
48
-
49
45
  end # each
50
46
 
51
- describe "unknown format_type" do
47
+ describe 'unknown format_type' do
52
48
  [
53
49
  :poop,
54
- "poop",
55
- Mixlib::Versioning
50
+ 'poop',
51
+ Mixlib::Versioning,
56
52
  ].each do |invalid_format_type|
57
-
58
- context "format_type is a: #{invalid_format_type.class}" do
59
- it "raises a Mixlib::Versioning::UnknownFormatError" do
53
+ context 'format_type is a: #{invalid_format_type.class}' do
54
+ it 'raises a Mixlib::Versioning::UnknownFormatError' do
60
55
  expect { subject.for(invalid_format_type) }.to raise_error(Mixlib::Versioning::UnknownFormatError)
61
56
  end # it
62
57
  end # context
63
-
64
58
  end # each
65
59
  end # describe
66
-
67
60
  end # describe ".for"
68
-
69
61
  end # describe Mixlib::Versioning::Format
@@ -1,5 +1,5 @@
1
1
  #
2
- # Author:: Seth Chisamore (<schisamo@opscode.com>)
2
+ # Author:: Seth Chisamore (<schisamo@chef.io>)
3
3
  # Copyright:: Copyright (c) 2013 Opscode, Inc.
4
4
  # License:: Apache License, Version 2.0
5
5
  #
@@ -19,241 +19,263 @@
19
19
  require 'spec_helper'
20
20
 
21
21
  describe Mixlib::Versioning do
22
+ subject { described_class }
22
23
 
23
- subject{ described_class }
24
+ let(:version_string) { '11.0.0' }
24
25
 
25
- let(:version_string){ "11.0.0" }
26
-
27
- describe ".parse" do
28
-
29
- describe "parsing when format type is specified" do
26
+ describe '.parse' do
27
+ describe 'parsing when format type is specified' do
30
28
  {
31
- "11.0.8" => {
32
- :format_type => :semver,
33
- :expected_format => Mixlib::Versioning::Format::SemVer
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,
34
36
  },
35
- "11.1.1" => {
36
- :format_type => :rubygems,
37
- :expected_format => Mixlib::Versioning::Format::Rubygems
37
+ '11.1.1.alpha.1' => {
38
+ format_type: :rubygems,
39
+ expected_format: Mixlib::Versioning::Format::Rubygems,
38
40
  },
39
- "11.1.1.alpha.1" => {
40
- :format_type => :rubygems,
41
- :expected_format => Mixlib::Versioning::Format::Rubygems
41
+ '11.1.1-alpha.1' => {
42
+ format_type: :opscode_semver,
43
+ expected_format: Mixlib::Versioning::Format::OpscodeSemVer,
42
44
  },
43
- "11.1.1-alpha.1" => {
44
- :format_type => :opscode_semver,
45
- :expected_format => Mixlib::Versioning::Format::OpscodeSemVer
45
+ '11.1.1-rc.2' => {
46
+ format_type: :opscode_semver,
47
+ expected_format: Mixlib::Versioning::Format::SemVer,
46
48
  },
47
- "11.1.1-rc.2" => {
48
- :format_type => :opscode_semver,
49
- :expected_format => Mixlib::Versioning::Format::SemVer
50
- }
51
49
  }.each_pair do |version_string, options|
52
-
53
50
  context "#{version_string} as #{options[:expected_format]}" do
54
- let(:version_string){ version_string }
55
- let(:expected_format){ options[:expected_format] }
51
+ let(:version_string) { version_string }
52
+ let(:expected_format) { options[:expected_format] }
56
53
 
57
54
  [
58
55
  options[:format_type],
59
56
  options[:format_type].to_s,
60
- options[:expected_format]
57
+ options[:expected_format],
61
58
  ].each do |format_type|
62
-
63
59
  context "format type as a: #{format_type.class}" do
64
60
  it "parses version string as: #{options[:expected_format]}" do
65
61
  result = subject.parse(version_string, format_type)
66
62
  result.should be_a(expected_format)
67
63
  end # it
68
64
  end # context
69
-
70
65
  end # each
71
66
  end # context
72
67
  end # each_pair
73
68
 
74
-
75
- describe "invalid format type specified" do
69
+ describe 'invalid format type specified' do
76
70
  [
77
71
  :poop,
78
- "poop",
79
- Mixlib::Versioning
72
+ 'poop',
73
+ Mixlib::Versioning,
80
74
  ].each do |invalid_format_type|
81
-
82
75
  context "invalid format as a: #{invalid_format_type.class}" do
83
- it "raises a Mixlib::Versioning::UnknownFormatError" do
76
+ it 'raises a Mixlib::Versioning::UnknownFormatError' do
84
77
  expect { subject.parse(version_string, invalid_format_type) }.to raise_error(Mixlib::Versioning::UnknownFormatError)
85
78
  end # it
86
79
  end # context
87
-
88
80
  end # each
89
-
90
81
  end # describe
91
82
  end # describe
92
83
 
93
- describe "parsing with automatic format detection" do
84
+ describe 'parsing with automatic format detection' do
94
85
  {
95
- "11.0.8" => Mixlib::Versioning::Format::SemVer,
96
- "11.0.8-1" => Mixlib::Versioning::Format::SemVer,
97
- "11.0.8.rc.1" => Mixlib::Versioning::Format::Rubygems,
98
- "11.0.8.rc.1-1" => Mixlib::Versioning::Format::Rubygems,
99
- "11.0.8-rc.1" => Mixlib::Versioning::Format::OpscodeSemVer,
100
-
101
- "10.18.2" => Mixlib::Versioning::Format::SemVer,
102
- "10.18.2-poop" => Mixlib::Versioning::Format::SemVer,
103
- "10.18.2.poop" => Mixlib::Versioning::Format::Rubygems,
104
- "10.18.2.poop-1" => Mixlib::Versioning::Format::Rubygems,
105
-
106
- "12.1.1+20130311134422" => Mixlib::Versioning::Format::OpscodeSemVer,
107
- "12.1.1-rc.3+20130311134422" => Mixlib::Versioning::Format::OpscodeSemVer,
108
- "12.1.1+20130308110833.git.2.94a1dde" => Mixlib::Versioning::Format::OpscodeSemVer,
109
-
110
- "10.16.2-49-g21353f0" => Mixlib::Versioning::Format::GitDescribe,
111
- "10.16.2-49-g21353f0-1" => Mixlib::Versioning::Format::GitDescribe,
112
- "10.16.2.rc.2-49-g21353f0" => Mixlib::Versioning::Format::GitDescribe,
113
- "10.16.2-rc.2-49-g21353f0" => Mixlib::Versioning::Format::GitDescribe,
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,
114
105
  }.each_pair do |version_string, expected_format|
115
-
116
106
  context version_string do
117
- let(:version_string){ version_string }
107
+ let(:version_string) { version_string }
118
108
  it "parses version string as: #{expected_format}" do
119
109
  subject.parse(version_string).should be_a(expected_format)
120
110
  end # it
121
111
  end # context
122
-
123
112
  end # each_pair
124
113
 
125
- describe "version_string cannot be parsed" do
126
- let(:version_string){ "A.B.C" }
127
- it "returns nil" do
114
+ describe 'version_string cannot be parsed' do
115
+ let(:version_string) { 'A.B.C' }
116
+ it 'returns nil' do
128
117
  subject.parse(version_string).should be_nil
129
118
  end
130
119
  end
131
-
132
120
  end # describe "parsing with automatic format detection"
133
121
 
134
- describe "parsing an Mixlib::Versioning::Format object" do
135
- it "returns the same object" do
122
+ describe 'parsing an Mixlib::Versioning::Format object' do
123
+ it 'returns the same object' do
136
124
  v = Mixlib::Versioning.parse(version_string)
137
125
  result = subject.parse(v)
138
126
  v.should be result
139
127
  end
140
128
  end
141
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
+ subject.parse(version_string, [Mixlib::Versioning::Format::Rubygems]).should be_nil
135
+ end
136
+
137
+ it 'returns nil when the array contains a string' do
138
+ subject.parse(version_string, ['rubygems']).should be_nil
139
+ end
140
+
141
+ it 'returns nil when the array contains a symbol' do
142
+ subject.parse(version_string, [:rubygems]).should 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
+ subject.parse(version_string, [expected_format]).should be_a(expected_format)
151
+ end
152
+
153
+ it 'returns nil when the array contains a string' do
154
+ subject.parse(version_string, ['git_describe']).should be_a(expected_format)
155
+ end
156
+
157
+ it 'returns nil when the array contains a symbol' do
158
+ subject.parse(version_string, [:git_describe]).should be_a(expected_format)
159
+ end
160
+ end
161
+ end
142
162
  end # describe .parse
143
163
 
144
- describe ".find_target_version" do
145
- let(:all_versions){%w{
146
- 11.0.0-beta.1
147
- 11.0.0-rc.1
148
- 11.0.0
149
- 11.0.1
150
- 11.0.1+2013031116332
151
- 11.0.2-alpha.0
152
- 11.0.2-alpha.0+2013041116332
153
- 11.0.2
154
- }}
155
- let(:filter_version){ nil }
156
- let(:use_prerelease_versions){ false }
157
- let(:use_build_versions){ false }
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 }
158
180
  let(:subject_find) do
159
- subject.find_target_version(all_versions,
160
- filter_version,
161
- use_prerelease_versions,
162
- use_build_versions)
181
+ subject.find_target_version(
182
+ all_versions,
183
+ filter_version,
184
+ use_prerelease_versions,
185
+ use_build_versions,
186
+ )
163
187
  end
164
188
 
165
189
  {
166
190
  nil => {
167
- :releases_only => "11.0.2",
168
- :prerelease_versions => "11.0.2-alpha.0",
169
- :build_versions => "11.0.1+2013031116332",
170
- :prerelease_and_build_versions => "11.0.2-alpha.0+2013041116332"
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,
171
201
  },
172
- "11.0.0" => {
173
- :releases_only => "11.0.0",
174
- :prerelease_versions => "11.0.0-rc.1",
175
- :build_versions => nil,
176
- :prerelease_and_build_versions => nil
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',
177
207
  },
178
- "11.0.2" => {
179
- :releases_only => "11.0.2",
180
- :prerelease_versions => "11.0.2-alpha.0",
181
- :build_versions => nil,
182
- :prerelease_and_build_versions => "11.0.2-alpha.0+2013041116332"
208
+ '11.0.2' => {
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',
183
213
  },
184
- "11.0.2" => {
185
- :releases_only => "11.0.2",
186
- :prerelease_versions => "11.0.2-alpha.0",
187
- :build_versions => nil,
188
- :prerelease_and_build_versions => "11.0.2-alpha.0+2013041116332"
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',
189
219
  },
190
- "11.0.2-alpha.0" => {
191
- :releases_only => "11.0.2-alpha.0",
192
- :prerelease_versions => "11.0.2-alpha.0",
193
- :build_versions => "11.0.2-alpha.0+2013041116332",
194
- :prerelease_and_build_versions => "11.0.2-alpha.0+2013041116332"
195
- }
196
220
  }.each_pair do |filter_version, options|
197
-
198
221
  context "filter version of: #{filter_version}" do
199
- let(:filter_version){ filter_version }
200
- let(:expected_version){ options[:releases_only] }
222
+ let(:filter_version) { filter_version }
223
+ let(:expected_version) { options[:releases_only] }
201
224
 
202
- it "finds the most recent release version" do
225
+ it 'finds the most recent release version' do
203
226
  subject_find.should eq Mixlib::Versioning.parse(expected_version)
204
227
  end
205
228
 
206
- context "include pre-release versions" do
207
- let(:use_prerelease_versions){ true }
208
- let(:expected_version){ options[:prerelease_versions] }
229
+ context 'include pre-release versions' do
230
+ let(:use_prerelease_versions) { true }
231
+ let(:expected_version) { options[:prerelease_versions] }
209
232
 
210
- it "finds the most recent pre-release version" do
233
+ it 'finds the most recent pre-release version' do
211
234
  subject_find.should eq Mixlib::Versioning.parse(expected_version)
212
235
  end # it
213
236
  end # context
214
237
 
215
- context "include build versions" do
216
- let(:use_build_versions){ true }
217
- let(:expected_version){ options[:build_versions] }
238
+ context 'include build versions' do
239
+ let(:use_build_versions) { true }
240
+ let(:expected_version) { options[:build_versions] }
218
241
 
219
- it "finds the most recent build version" do
242
+ it 'finds the most recent build version' do
220
243
  subject_find.should eq Mixlib::Versioning.parse(expected_version)
221
244
  end # it
222
245
  end # context
223
246
 
224
- context "include pre-release and build versions" do
225
- let(:use_prerelease_versions){ true }
226
- let(:use_build_versions){ true }
227
- let(:expected_version){ options[:prerelease_and_build_versions] }
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] }
228
251
 
229
- it "finds the most recent pre-release build version" do
252
+ it 'finds the most recent pre-release build version' do
230
253
  subject_find.should eq Mixlib::Versioning.parse(expected_version)
231
254
  end # it
232
255
  end # context
233
-
234
256
  end # context
235
257
  end # each_pair
236
258
 
237
- describe "all_versions argument is a mix of String and Mixlib::Versioning::Format instances" do
238
- let(:all_versions){[
239
- "11.0.0-beta.1",
240
- "11.0.0-rc.1",
241
- Mixlib::Versioning.parse("11.0.0")
242
- ]}
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
243
267
 
244
- it "correctly parses the array" do
245
- subject_find.should eq Mixlib::Versioning.parse("11.0.0")
268
+ it 'correctly parses the array' do
269
+ subject_find.should eq Mixlib::Versioning.parse('11.0.0')
246
270
  end
247
271
  end # describe
248
272
 
249
- describe "filter_version argument is an instance of Mixlib::Versioning::Format" do
250
- let(:filter_version){ Mixlib::Versioning::Format::SemVer.new("11.0.0") }
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') }
251
275
 
252
- it "finds the correct version" do
253
- subject_find.should eq Mixlib::Versioning.parse("11.0.0")
276
+ it 'finds the correct version' do
277
+ subject_find.should eq Mixlib::Versioning.parse('11.0.0')
254
278
  end
255
279
  end
256
-
257
280
  end # describe
258
-
259
281
  end # describe Mixlib::Versioning