uniq_identifier 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +2 -1
- data/CHANGELOG.md +9 -0
- data/Gemfile +1 -1
- data/Rakefile +3 -4
- data/bin/console +8 -0
- data/bin/setup +7 -0
- data/lib/uniq_identifier.rb +1 -0
- data/lib/uniq_identifier/version.rb +1 -1
- data/spec/spec_helper.rb +2 -0
- data/spec/uniq_identifier/uniq_identifier_spec.rb +15 -10
- metadata +7 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6ae67a2e8c41e72b1ce093225ba045e49dc2657f
|
4
|
+
data.tar.gz: 54eb0124b08b54a3d8dd5ccda5041980ecec8de1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 417c2e239763f9271c83c739bb02761cba7d0390056a16366efb4173475b24b8a24f0607a6d9bf9777be3047e32cbfc5b1b9d2b9a391cd454e50427991e32237
|
7
|
+
data.tar.gz: fa51e4f12e137a88f0138c536a67fb45aec525eab3a3532c6a6bb7b7a5c3280cf4ef3d4dbd62ecf2b6e356c1ed00de16c58256f4f150a73ee59ae73ac59891ac
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,12 @@
|
|
1
|
+
### VERSION 0.0.7
|
2
|
+
|
3
|
+
* Enhancements
|
4
|
+
* Add validation model of presence and uniqueness
|
5
|
+
* Update Ruby from 2.1.2 to 2.3.1
|
6
|
+
* Use last version of the gem Ammeter => 1.1.4
|
7
|
+
* Re-add generator specs
|
8
|
+
* Add bin/console
|
9
|
+
|
1
10
|
### VERSION 0.0.6
|
2
11
|
|
3
12
|
* Enhancements
|
data/Gemfile
CHANGED
data/Rakefile
CHANGED
@@ -13,14 +13,13 @@ task :default => [ :spec ]
|
|
13
13
|
|
14
14
|
desc 'Run all specs'
|
15
15
|
task 'spec' do
|
16
|
-
|
17
|
-
|
16
|
+
Rake::Task['generators'].invoke
|
17
|
+
return_code1 = $?.exitstatus
|
18
18
|
|
19
19
|
Rake::Task['uniq_identifier'].invoke
|
20
20
|
return_code2 = $?.exitstatus
|
21
21
|
|
22
|
-
|
23
|
-
fail if return_code2 != 0
|
22
|
+
fail if return_code1 != 0 || return_code2 != 0
|
24
23
|
end
|
25
24
|
|
26
25
|
desc 'Run specs for all adapters'
|
data/bin/console
ADDED
data/bin/setup
ADDED
data/lib/uniq_identifier.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
@@ -2,13 +2,18 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe UniqIdentifier do
|
4
4
|
let(:user) { User.new }
|
5
|
+
let(:fake_uuid) { SecureRandom.uuid }
|
6
|
+
|
7
|
+
before do
|
8
|
+
allow(UniqIdentifier).to receive_message_chain('configuration.generator.uuid') { fake_uuid }
|
9
|
+
end
|
5
10
|
|
6
11
|
specify 'lazy load' do
|
7
12
|
expect {
|
8
|
-
expect(user.uuid).to eql(
|
13
|
+
expect(user.uuid).to eql(fake_uuid)
|
9
14
|
}.to change {
|
10
15
|
user.attributes['uuid']
|
11
|
-
}.from(nil).to(
|
16
|
+
}.from(nil).to(fake_uuid)
|
12
17
|
end
|
13
18
|
|
14
19
|
specify do
|
@@ -16,7 +21,7 @@ describe UniqIdentifier do
|
|
16
21
|
user.save!
|
17
22
|
}.to change {
|
18
23
|
user.attributes['uuid']
|
19
|
-
}.from(nil).to(
|
24
|
+
}.from(nil).to(fake_uuid)
|
20
25
|
end
|
21
26
|
|
22
27
|
context 'persistence' do
|
@@ -26,39 +31,39 @@ describe UniqIdentifier do
|
|
26
31
|
before { user.save! }
|
27
32
|
|
28
33
|
specify do
|
29
|
-
expect(User.find(user_id).uuid).to eql(
|
34
|
+
expect(User.find(user_id).uuid).to eql(fake_uuid)
|
30
35
|
end
|
31
36
|
end
|
32
37
|
|
33
38
|
context 'keep given uuid on save' do
|
34
39
|
before do
|
35
|
-
user.uuid =
|
40
|
+
user.uuid = fake_uuid
|
36
41
|
user.save!
|
37
42
|
end
|
38
43
|
|
39
44
|
specify do
|
40
|
-
expect(User.find(user_id).uuid).to eql(
|
45
|
+
expect(User.find(user_id).uuid).to eql(fake_uuid)
|
41
46
|
end
|
42
47
|
end
|
43
48
|
|
44
49
|
context 'keep given uuid on save' do
|
45
50
|
before do
|
46
|
-
user.attributes = { uuid:
|
51
|
+
user.attributes = { uuid: fake_uuid }
|
47
52
|
user.save!
|
48
53
|
end
|
49
54
|
|
50
55
|
specify do
|
51
|
-
expect(User.find(user_id).uuid).to eql(
|
56
|
+
expect(User.find(user_id).uuid).to eql(fake_uuid)
|
52
57
|
end
|
53
58
|
end
|
54
59
|
|
55
60
|
context 'keep given uuid on save' do
|
56
|
-
let(:user) { User.new({ uuid:
|
61
|
+
let(:user) { User.new({ uuid: fake_uuid }) }
|
57
62
|
|
58
63
|
before { user.save! }
|
59
64
|
|
60
65
|
specify do
|
61
|
-
expect(User.find(user_id).uuid).to eql(
|
66
|
+
expect(User.find(user_id).uuid).to eql(fake_uuid)
|
62
67
|
end
|
63
68
|
end
|
64
69
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: uniq_identifier
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joel AZEMAR
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-09-
|
11
|
+
date: 2016-09-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -41,7 +41,9 @@ dependencies:
|
|
41
41
|
description: Add an uniq identifier on your models
|
42
42
|
email:
|
43
43
|
- joel.azemar@gmail.com
|
44
|
-
executables:
|
44
|
+
executables:
|
45
|
+
- console
|
46
|
+
- setup
|
45
47
|
extensions: []
|
46
48
|
extra_rdoc_files: []
|
47
49
|
files:
|
@@ -54,6 +56,8 @@ files:
|
|
54
56
|
- LICENSE.txt
|
55
57
|
- README.md
|
56
58
|
- Rakefile
|
59
|
+
- bin/console
|
60
|
+
- bin/setup
|
57
61
|
- lib/generators/uniq_identifier/add_generator.rb
|
58
62
|
- lib/generators/uniq_identifier/install_generator.rb
|
59
63
|
- lib/generators/uniq_identifier/templates/README-active_record
|