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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a239d021344adf722c7a7ee611be695672c346d3
4
- data.tar.gz: 417b2dbc4c43505f2cdaea2f6db29298b885e607
3
+ metadata.gz: 6ae67a2e8c41e72b1ce093225ba045e49dc2657f
4
+ data.tar.gz: 54eb0124b08b54a3d8dd5ccda5041980ecec8de1
5
5
  SHA512:
6
- metadata.gz: 461c221c17a4c4e68016185820cca009f7340e490800ab4c3c59474d5ff90ca7f157781b652c2e53a1185462afc95ffe9efe21bd877a5014c3de784d27c9c4d1
7
- data.tar.gz: 4ccef7de5a3846ae561f26c877cfc86a5890e8fc53abff63fe8b3233be63427b08378f2c100607bcbd7bc74c9223154cdc52c4d103ed7699d836a31c0333013b
6
+ metadata.gz: 417c2e239763f9271c83c739bb02761cba7d0390056a16366efb4173475b24b8a24f0607a6d9bf9777be3047e32cbfc5b1b9d2b9a391cd454e50427991e32237
7
+ data.tar.gz: fa51e4f12e137a88f0138c536a67fb45aec525eab3a3532c6a6bb7b7a5c3280cf4ef3d4dbd62ecf2b6e356c1ed00de16c58256f4f150a73ee59ae73ac59891ac
@@ -1,4 +1,5 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.1.2
3
+ - 2.3.1
4
4
  script: bundle exec rspec spec
5
+ sudo: false # https://github.com/bundler/bundler/issues/3558#issuecomment-171347979 related to https://travis-ci.org/joel/uniq_identifier/builds/163131859
@@ -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
@@ -15,5 +15,5 @@ group :test do
15
15
  end
16
16
  gem 'coveralls', require: false
17
17
  gem 'pry'
18
- # gem 'ammeter'
18
+ gem 'ammeter', '1.1.4'
19
19
  end
data/Rakefile CHANGED
@@ -13,14 +13,13 @@ task :default => [ :spec ]
13
13
 
14
14
  desc 'Run all specs'
15
15
  task 'spec' do
16
- # Rake::Task['generators'].invoke
17
- # return_code1 = $?.exitstatus
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
- # fail if return_code1 != 0 || return_code2 != 0
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'
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'bundler/setup'
4
+
5
+ require 'uniq_identifier'
6
+
7
+ require 'irb'
8
+ IRB.start
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+
5
+ bundle install
6
+
7
+ # Do any other automated setup that you need to do here
@@ -9,5 +9,6 @@ module UniqIdentifier
9
9
  def uniq_identifier
10
10
  prepend Hook
11
11
  before_save :set_uniq_identifier
12
+ validates :uuid, presence: true, uniqueness: true
12
13
  end
13
14
  end
@@ -1,3 +1,3 @@
1
1
  module UniqIdentifier
2
- VERSION = '0.0.6'
2
+ VERSION = '0.0.7'
3
3
  end
@@ -2,6 +2,8 @@ require 'uniq_identifier'
2
2
  require 'bundler/setup'
3
3
  require 'coveralls'
4
4
 
5
+ require 'rails/all'
6
+
5
7
  begin
6
8
  require 'pry'
7
9
  rescue LoadError
@@ -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('0c6bbc03-a269-44e2-8075-f442e1aac0c8')
13
+ expect(user.uuid).to eql(fake_uuid)
9
14
  }.to change {
10
15
  user.attributes['uuid']
11
- }.from(nil).to('0c6bbc03-a269-44e2-8075-f442e1aac0c8')
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('0c6bbc03-a269-44e2-8075-f442e1aac0c8')
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('0c6bbc03-a269-44e2-8075-f442e1aac0c8')
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 = 'What Ever 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('What Ever Uuid')
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: 'What Ever 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('What Ever Uuid')
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: 'What Ever 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('What Ever Uuid')
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.6
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-20 00:00:00.000000000 Z
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