vidibus-uuid 0.3.9 → 0.3.10

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.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.9
1
+ 0.3.10
@@ -25,7 +25,9 @@ module Vidibus
25
25
 
26
26
  # Sets unique UUID unless uuid is present.
27
27
  def generate_uuid
28
- self.uuid ||= Vidibus::Uuid.generate
28
+ if [nil, ""].include?(uuid)
29
+ self.uuid = Vidibus::Uuid.generate
30
+ end
29
31
  end
30
32
  end
31
33
  end
@@ -25,6 +25,19 @@ describe "Vidibus::Uuid::Mongoid" do
25
25
  model.uuid.length.should eql(32)
26
26
  end
27
27
 
28
+ it "should not generate a new UUID if a value has been set" do
29
+ new_model.uuid = "test"
30
+ new_model.save
31
+ new_model.uuid.should eql("test")
32
+ end
33
+
34
+ it "should generate a new UUID if a blank value has been set" do
35
+ new_model.uuid = ""
36
+ new_model.save
37
+ new_model.uuid.should_not eql("")
38
+ new_model.should be_valid
39
+ end
40
+
28
41
  it "should keep the UUID persistent" do
29
42
  uuid = model.uuid
30
43
  model.save!
data/vidibus-uuid.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{vidibus-uuid}
8
- s.version = "0.3.9"
8
+ s.version = "0.3.10"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Andre Pankratz"]
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vidibus-uuid
3
3
  version: !ruby/object:Gem::Version
4
- hash: 1
4
+ hash: 7
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 3
9
- - 9
10
- version: 0.3.9
9
+ - 10
10
+ version: 0.3.10
11
11
  platform: ruby
12
12
  authors:
13
13
  - Andre Pankratz