semverse 1.2.0 → 1.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 73fe502f1b8e6b562437526465d0b8edf3d4b824
4
- data.tar.gz: 15677e221b985d6a8d49c704158b5210a0762992
3
+ metadata.gz: dd2cf18c6c57fd6cafb42a24eb98f8b7bf10ba31
4
+ data.tar.gz: c9222204986cb821a09e73ce889369b054a66b5a
5
5
  SHA512:
6
- metadata.gz: b49efa1971b45408cd1f5aee123b990df9ebfeb8e6efcea8f31ee7c4787e6af544138400dfd72bab9a468fa19b7731469976e35e9f3ce16b806370ac5c09f948
7
- data.tar.gz: cf8e35b148d259c155891714306d50c5ef327acdde56776fd202470aa5c5c2a747358848e7230cef359d639f9989a22b55c1a3db18955f594770c51e70c58061
6
+ metadata.gz: 614d1b76c8616308176bf894ccdc14223b085ddad832b81fcdb082cae91b04f4ba7b6dda0d3654cace0ebf6f0aeb25fed9c2e1b144ef6c165d992d3ec5746610
7
+ data.tar.gz: 9dcb6b53997d79124c6aca69dafb60f590657d1d985ffada15e62d64ea5bfe8a95199182f7b5fb409c6b8b12d072c39e4a67de8d14331bf7140a349448816cb8
@@ -166,6 +166,10 @@ module Semverse
166
166
 
167
167
  # @param [#to_s] constraint
168
168
  def initialize(constraint = '>= 0.0.0')
169
+ constraint = constraint.to_s
170
+ if constraint.nil? || constraint.empty?
171
+ constraint = ">= 0.0.0"
172
+ end
169
173
  @operator, @major, @minor, @patch, @pre_release, @build = self.class.split(constraint)
170
174
 
171
175
  unless ['~>', '~'].include?(@operator)
@@ -1,3 +1,3 @@
1
1
  module Semverse
2
- VERSION = "1.2.0"
2
+ VERSION = "1.2.1"
3
3
  end
@@ -33,6 +33,20 @@ describe Semverse::Constraint do
33
33
  expect(result.version.to_s).to eq("0.0.0")
34
34
  end
35
35
 
36
+ it "falls back to a default constraint if nil is provided" do
37
+ result = subject.new(nil)
38
+
39
+ expect(result.version.to_s).to eq("0.0.0")
40
+ expect(result.operator).to eq(">=")
41
+ end
42
+
43
+ it "fall sback to a default constraint if a blank string is provided" do
44
+ result = subject.new("")
45
+
46
+ expect(result.version.to_s).to eq("0.0.0")
47
+ expect(result.operator).to eq(">=")
48
+ end
49
+
36
50
  context "given a string that does not match the Constraint REGEXP" do
37
51
  it "raises an InvalidConstraintFormat error" do
38
52
  expect {
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: semverse
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jamie Winsor