mongoid-uuid 0.0.4 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/mongoid/uuid/uuid.rb +2 -4
- data/lib/mongoid/uuid/version.rb +1 -1
- data/spec/spec_helper.rb +2 -1
- data/spec/uuid_spec.rb +3 -5
- metadata +40 -46
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0a09f1f6674b3cc43f63857db7aee73011ee1d99
|
4
|
+
data.tar.gz: 29e69bb0993e2210e30b82659f0eaeb0d6451115
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1fdec02f99491b7292c024fb98d837edcf2adbcca39f3ad750b06bde55bfc0b7de6090956a3bacf28f76bcc3e38f8cade2b8c2d8b6358ad96b19e40f48e72b1e
|
7
|
+
data.tar.gz: 5e5bef8c98ef04d7fdeafe2c84f1f091488d35727f9bfa5bfabffbecb7f65d554c36b4e027bcf93eb89c8d5fbe8753a20db53d2059f88cf58ff5838626b1e1eb
|
data/lib/mongoid/uuid/uuid.rb
CHANGED
@@ -8,7 +8,7 @@ module Mongoid # :nodoc:
|
|
8
8
|
field :uuid
|
9
9
|
index({:uuid => 1}, {:unique => true})
|
10
10
|
before_validation :generate_uuid
|
11
|
-
validates :uuid, :uniqueness => true, :uuid =>
|
11
|
+
validates :uuid, :uniqueness => true, :uuid => true
|
12
12
|
attr_readonly :uuid
|
13
13
|
end
|
14
14
|
|
@@ -16,9 +16,7 @@ module Mongoid # :nodoc:
|
|
16
16
|
|
17
17
|
# Sets unique UUID unless uuid is present.
|
18
18
|
def generate_uuid
|
19
|
-
|
20
|
-
self.uuid = UUID.generate
|
21
|
-
end
|
19
|
+
self.uuid = UUID.generate if uuid.to_s.empty?
|
22
20
|
end
|
23
21
|
end
|
24
22
|
end
|
data/lib/mongoid/uuid/version.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
@@ -3,6 +3,7 @@ require 'bundler/setup'
|
|
3
3
|
|
4
4
|
require 'mongoid'
|
5
5
|
require 'mongoid/uuid'
|
6
|
+
require 'mongoid-rspec'
|
6
7
|
|
7
8
|
require 'rspec'
|
8
9
|
|
@@ -19,7 +20,7 @@ Mongoid.configure do |config|
|
|
19
20
|
config.connect_to('mongoid_uuid_test')
|
20
21
|
end
|
21
22
|
|
22
|
-
require
|
23
|
+
require 'model'
|
23
24
|
|
24
25
|
RSpec.configure do |config|
|
25
26
|
config.expect_with :rspec do |c|
|
data/spec/uuid_spec.rb
CHANGED
@@ -10,22 +10,20 @@ describe Mongoid::Uuid do
|
|
10
10
|
end
|
11
11
|
|
12
12
|
it "create with generated uuid" do
|
13
|
-
uuid = UUID.generate
|
13
|
+
uuid = UUID.generate
|
14
14
|
item = ItemWithUuid.create!(name: 'foo', uuid: uuid)
|
15
15
|
expect(item.uuid).to eq(uuid)
|
16
16
|
end
|
17
17
|
|
18
18
|
it "create with invalid uuid exception" do
|
19
|
-
invalid_uuid = 'baz-
|
19
|
+
invalid_uuid = 'baz-baz1'
|
20
20
|
expect {
|
21
|
-
|
22
21
|
ItemWithUuid.create!(name: 'foo', uuid: invalid_uuid)
|
23
|
-
|
24
22
|
}.to raise_error(Mongoid::Errors::Validations)
|
25
23
|
end
|
26
24
|
|
27
25
|
it "create with invalid uuid" do
|
28
|
-
invalid_uuid = 'baz-
|
26
|
+
invalid_uuid = 'baz-baz2'
|
29
27
|
expect(ItemWithUuid.create(name: 'foo', uuid: invalid_uuid).valid?).to eq(false)
|
30
28
|
end
|
31
29
|
|
metadata
CHANGED
@@ -1,105 +1,99 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mongoid-uuid
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
7
|
+
- Yury Druzkov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-10-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: uuid
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 2.3
|
19
|
+
version: '2.3'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 2.3
|
26
|
+
version: '2.3'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: yard
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '4.0'
|
34
|
-
- - '>='
|
31
|
+
- - ">="
|
35
32
|
- !ruby/object:Gem::Version
|
36
|
-
version: '
|
33
|
+
version: '0'
|
37
34
|
type: :runtime
|
38
35
|
prerelease: false
|
39
36
|
version_requirements: !ruby/object:Gem::Requirement
|
40
37
|
requirements:
|
41
|
-
- -
|
42
|
-
- !ruby/object:Gem::Version
|
43
|
-
version: '4.0'
|
44
|
-
- - '>='
|
38
|
+
- - ">="
|
45
39
|
- !ruby/object:Gem::Version
|
46
|
-
version: '
|
40
|
+
version: '0'
|
47
41
|
- !ruby/object:Gem::Dependency
|
48
42
|
name: rake
|
49
43
|
requirement: !ruby/object:Gem::Requirement
|
50
44
|
requirements:
|
51
|
-
- -
|
45
|
+
- - ">="
|
52
46
|
- !ruby/object:Gem::Version
|
53
|
-
version: 0
|
54
|
-
type: :
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
55
49
|
prerelease: false
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
57
51
|
requirements:
|
58
|
-
- -
|
52
|
+
- - ">="
|
59
53
|
- !ruby/object:Gem::Version
|
60
|
-
version: 0
|
54
|
+
version: '0'
|
61
55
|
- !ruby/object:Gem::Dependency
|
62
|
-
name:
|
56
|
+
name: mongoid
|
63
57
|
requirement: !ruby/object:Gem::Requirement
|
64
58
|
requirements:
|
65
|
-
- -
|
59
|
+
- - ">="
|
66
60
|
- !ruby/object:Gem::Version
|
67
|
-
version: '
|
68
|
-
type: :
|
61
|
+
version: '3.0'
|
62
|
+
type: :runtime
|
69
63
|
prerelease: false
|
70
64
|
version_requirements: !ruby/object:Gem::Requirement
|
71
65
|
requirements:
|
72
|
-
- -
|
66
|
+
- - ">="
|
73
67
|
- !ruby/object:Gem::Version
|
74
|
-
version: '
|
68
|
+
version: '3.0'
|
75
69
|
- !ruby/object:Gem::Dependency
|
76
|
-
name:
|
70
|
+
name: rspec
|
77
71
|
requirement: !ruby/object:Gem::Requirement
|
78
72
|
requirements:
|
79
|
-
- - ~>
|
73
|
+
- - "~>"
|
80
74
|
- !ruby/object:Gem::Version
|
81
|
-
version: '0
|
82
|
-
type: :
|
75
|
+
version: '3.0'
|
76
|
+
type: :runtime
|
83
77
|
prerelease: false
|
84
78
|
version_requirements: !ruby/object:Gem::Requirement
|
85
79
|
requirements:
|
86
|
-
- - ~>
|
80
|
+
- - "~>"
|
87
81
|
- !ruby/object:Gem::Version
|
88
|
-
version: '0
|
82
|
+
version: '3.0'
|
89
83
|
- !ruby/object:Gem::Dependency
|
90
84
|
name: mongoid-rspec
|
91
85
|
requirement: !ruby/object:Gem::Requirement
|
92
86
|
requirements:
|
93
|
-
- -
|
87
|
+
- - "~>"
|
94
88
|
- !ruby/object:Gem::Version
|
95
|
-
version:
|
96
|
-
type: :
|
89
|
+
version: 2.0.0.rc1
|
90
|
+
type: :runtime
|
97
91
|
prerelease: false
|
98
92
|
version_requirements: !ruby/object:Gem::Requirement
|
99
93
|
requirements:
|
100
|
-
- -
|
94
|
+
- - "~>"
|
101
95
|
- !ruby/object:Gem::Version
|
102
|
-
version:
|
96
|
+
version: 2.0.0.rc1
|
103
97
|
description: ''
|
104
98
|
email:
|
105
99
|
- bad1lamer@gmail.com
|
@@ -108,12 +102,12 @@ extensions: []
|
|
108
102
|
extra_rdoc_files: []
|
109
103
|
files:
|
110
104
|
- lib/mongoid/uuid.rb
|
111
|
-
- lib/mongoid/uuid/validator.rb
|
112
105
|
- lib/mongoid/uuid/uuid.rb
|
106
|
+
- lib/mongoid/uuid/validator.rb
|
113
107
|
- lib/mongoid/uuid/version.rb
|
114
108
|
- spec/model.rb
|
115
|
-
- spec/uuid_spec.rb
|
116
109
|
- spec/spec_helper.rb
|
110
|
+
- spec/uuid_spec.rb
|
117
111
|
homepage: http://github.com/badlamer/mongoid-uuid
|
118
112
|
licenses:
|
119
113
|
- MIT
|
@@ -124,22 +118,22 @@ require_paths:
|
|
124
118
|
- lib
|
125
119
|
required_ruby_version: !ruby/object:Gem::Requirement
|
126
120
|
requirements:
|
127
|
-
- -
|
121
|
+
- - ">="
|
128
122
|
- !ruby/object:Gem::Version
|
129
123
|
version: '1.9'
|
130
124
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
131
125
|
requirements:
|
132
|
-
- -
|
126
|
+
- - ">="
|
133
127
|
- !ruby/object:Gem::Version
|
134
128
|
version: 1.3.6
|
135
129
|
requirements: []
|
136
130
|
rubyforge_project: mongoid-uuid
|
137
|
-
rubygems_version: 2.
|
131
|
+
rubygems_version: 2.2.2
|
138
132
|
signing_key:
|
139
133
|
specification_version: 4
|
140
134
|
summary: Uuid fields for mongoid
|
141
135
|
test_files:
|
142
|
-
- spec/model.rb
|
143
136
|
- spec/uuid_spec.rb
|
144
137
|
- spec/spec_helper.rb
|
138
|
+
- spec/model.rb
|
145
139
|
has_rdoc:
|