paranoia_uniqueness_validator 2.0.0 → 3.0.0

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: d6c43ab07ae51e7b81827a2eb89534c4fd26ef36
4
- data.tar.gz: a5a83e727c9ea0a0a6b45a06164fc52c2b44465d
3
+ metadata.gz: ad82f8dc3a747d34926d95905b6194f554db18f6
4
+ data.tar.gz: b5a9e10595083c04576275f1a6ddb99ed1091ea8
5
5
  SHA512:
6
- metadata.gz: 5e57390dcc1bdee3a5d356fdf0d94bebc9c08b5501fe74de02c0bbee526139dad60a46ddf7d5cc32eb626d645bd6b32a199b3ec30e7abb4415762ff3ffd4ae62
7
- data.tar.gz: 0bbf526c132a4c7efb252ed0704d946a0de03809595e4868cdbcdb7134c6940e41bc396a7c9c80d1beb1fb1e7e902115d5d60ba5223954024bfbab18d309d8e3
6
+ metadata.gz: 6d0780ebd71e952aaabbd1de3101d6fe86b22b8154c190e038f05e4a1841d27efdb92ecdd7487887d7443641fa62cc2c6734d8e1da7348e678137842b015c15a
7
+ data.tar.gz: 12e46e861c058e500e3273711287d4c59501a9e5f294be2b325c94287a7fd7a13b50d97a5cb1523a14976aa0f88d592a6f2c5ad70dee9006651b832c6e96c493
data/.travis.yml CHANGED
@@ -2,12 +2,12 @@ language: ruby
2
2
  rvm:
3
3
  - 2.2.5
4
4
  - 2.3.0
5
+ - 2.4.0
5
6
  - ruby-head
6
7
  - jruby-head
7
8
  env:
8
9
  - "RAILS_VERSION=master"
9
- - "RAILS_VERSION=5.0.0"
10
- - "RAILS_VERSION=5.0.0.1"
10
+ - "RAILS_VERSION=5.1.0"
11
11
  matrix:
12
12
  allow_failures:
13
13
  - rvm: ruby-head
data/Gemfile CHANGED
@@ -10,7 +10,7 @@ rails = case rails_version
10
10
  when 'master'
11
11
  { github: 'rails/rails' }
12
12
  when 'default'
13
- '>= 5.0.0'
13
+ '>= 5.1.0'
14
14
  else
15
15
  "~> #{rails_version}"
16
16
  end
data/README.md CHANGED
@@ -16,9 +16,12 @@ Add this line to your application's Gemfile:
16
16
  # Rails 4
17
17
  gem 'paranoia_uniqueness_validator', '1.1.0'
18
18
 
19
- # Rails 5
19
+ # Rails 5.0
20
20
  gem 'paranoia_uniqueness_validator', '2.0.0'
21
-
21
+
22
+ # Rails 5.1
23
+ gem 'paranoia_uniqueness_validator', '3.0.0'
24
+
22
25
  And then execute:
23
26
 
24
27
  $ bundle
data/docker-compose.yml CHANGED
@@ -1,8 +1,8 @@
1
1
  version: '2'
2
2
  services:
3
3
  lib:
4
- build: .
5
4
  command: rspec
5
+ image: sticksnleaves/ruby-project:2.4
6
6
  volumes:
7
7
  - .:/usr/src/app
8
8
  - lib.volume:/usr/local/bundle
@@ -3,18 +3,17 @@ module ParanoiaUniquenessValidator
3
3
  class UniquenessWithoutDeletedValidator < ActiveRecord::Validations::UniquenessValidator
4
4
  def validate_each(record, attribute, value)
5
5
  finder_class = find_finder_class_for(record)
6
- table = finder_class.arel_table
7
6
  value = map_enum_attribute(finder_class, attribute, value)
8
7
 
9
- relation = build_relation(finder_class, table, attribute, value)
8
+ relation = build_relation(finder_class, attribute, value)
10
9
  if record.persisted?
11
10
  if finder_class.primary_key
12
- relation = relation.where.not(finder_class.primary_key => record.id_was || record.id)
11
+ relation = relation.where.not(finder_class.primary_key => record.id_in_database || record.id)
13
12
  else
14
13
  raise UnknownPrimaryKey.new(finder_class, "Can not validate uniqueness for persisted record without primary key.")
15
14
  end
16
15
  end
17
- relation = scope_relation(record, table, relation)
16
+ relation = scope_relation(record, relation)
18
17
  relation = relation.merge(options[:conditions]) if options[:conditions]
19
18
 
20
19
  if defined?('Paranoia') && Paranoia.respond_to?(:default_sentinel_value)
@@ -1,3 +1,3 @@
1
1
  module ParanoiaUniquenessValidator
2
- VERSION = "2.0.0"
2
+ VERSION = "3.0.0"
3
3
  end
@@ -10,16 +10,17 @@ Gem::Specification.new do |gem|
10
10
  gem.email = ["anthony@sticksnleaves.com"]
11
11
  gem.description = %q{Adds the validates_uniqueness_without_deleted validator to ignore deleted fields when validating for uniqueness.}
12
12
  gem.summary = %q{Validate unique fields without letting those pesky deleted records get in the way. Great for use with Paranoia.}
13
- gem.homepage = ""
13
+ gem.homepage = "https://github.com/anthonator/paranoia_uniqueness_validator"
14
+ gem.license = "MIT"
14
15
 
15
16
  gem.files = `git ls-files`.split($/)
16
17
  gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
17
18
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
18
19
  gem.require_paths = ["lib"]
19
20
 
20
- gem.add_dependency "activerecord", ">= 5.0.0", "< 5.1"
21
+ gem.add_dependency "activerecord", ">= 5.1.0", "< 5.2"
21
22
 
22
- gem.add_development_dependency "paranoia"
23
- gem.add_development_dependency "database_cleaner"
24
- gem.add_development_dependency "rspec-rails"
23
+ gem.add_development_dependency "paranoia", "~> 2.3"
24
+ gem.add_development_dependency "database_cleaner", "~> 1.6"
25
+ gem.add_development_dependency "rspec-rails", "~> 3.6"
25
26
  end
@@ -17,8 +17,5 @@ ActiveSupport.to_time_preserves_timezone = true
17
17
  # Require `belongs_to` associations by default. Previous versions had false.
18
18
  Rails.application.config.active_record.belongs_to_required_by_default = true
19
19
 
20
- # Do not halt callback chains when a callback returns false. Previous versions had true.
21
- ActiveSupport.halt_callback_chains_on_return_false = false
22
-
23
20
  # Configure SSL options to enable HSTS with subdomains. Previous versions had false.
24
21
  Rails.application.config.ssl_options = { hsts: { subdomains: true } }
@@ -32,14 +32,15 @@ describe ParanoiaUniquenessValidator::Validations::UniquenessWithoutDeletedValid
32
32
 
33
33
  it "should validate uniqueness" do
34
34
  DummyNonNilModel.create(:unique_field => "unique")
35
- DummyNonNilModel.new(:unique_field => "unique").should_not be_valid
35
+
36
+ expect(DummyNonNilModel.new(:unique_field => "unique")).to_not be_valid
36
37
  end
37
38
 
38
39
  it "should should be valid if not unique with a deleted record" do
39
40
  dummy_model = DummyNonNilModel.create(:unique_field => "unique")
40
41
  dummy_model.destroy
41
42
  dummy_model = DummyNonNilModel.new(:unique_field => "unique")
42
- dummy_model.should be_valid
43
+ expect(dummy_model).to be_valid
43
44
  end
44
45
 
45
46
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: paranoia_uniqueness_validator
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 3.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anthony Smith
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-08-26 00:00:00.000000000 Z
11
+ date: 2017-05-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -16,62 +16,62 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 5.0.0
19
+ version: 5.1.0
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
- version: '5.1'
22
+ version: '5.2'
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
27
  - - ">="
28
28
  - !ruby/object:Gem::Version
29
- version: 5.0.0
29
+ version: 5.1.0
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
- version: '5.1'
32
+ version: '5.2'
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: paranoia
35
35
  requirement: !ruby/object:Gem::Requirement
36
36
  requirements:
37
- - - ">="
37
+ - - "~>"
38
38
  - !ruby/object:Gem::Version
39
- version: '0'
39
+ version: '2.3'
40
40
  type: :development
41
41
  prerelease: false
42
42
  version_requirements: !ruby/object:Gem::Requirement
43
43
  requirements:
44
- - - ">="
44
+ - - "~>"
45
45
  - !ruby/object:Gem::Version
46
- version: '0'
46
+ version: '2.3'
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: database_cleaner
49
49
  requirement: !ruby/object:Gem::Requirement
50
50
  requirements:
51
- - - ">="
51
+ - - "~>"
52
52
  - !ruby/object:Gem::Version
53
- version: '0'
53
+ version: '1.6'
54
54
  type: :development
55
55
  prerelease: false
56
56
  version_requirements: !ruby/object:Gem::Requirement
57
57
  requirements:
58
- - - ">="
58
+ - - "~>"
59
59
  - !ruby/object:Gem::Version
60
- version: '0'
60
+ version: '1.6'
61
61
  - !ruby/object:Gem::Dependency
62
62
  name: rspec-rails
63
63
  requirement: !ruby/object:Gem::Requirement
64
64
  requirements:
65
- - - ">="
65
+ - - "~>"
66
66
  - !ruby/object:Gem::Version
67
- version: '0'
67
+ version: '3.6'
68
68
  type: :development
69
69
  prerelease: false
70
70
  version_requirements: !ruby/object:Gem::Requirement
71
71
  requirements:
72
- - - ">="
72
+ - - "~>"
73
73
  - !ruby/object:Gem::Version
74
- version: '0'
74
+ version: '3.6'
75
75
  description: Adds the validates_uniqueness_without_deleted validator to ignore deleted
76
76
  fields when validating for uniqueness.
77
77
  email:
@@ -82,7 +82,6 @@ extra_rdoc_files: []
82
82
  files:
83
83
  - ".gitignore"
84
84
  - ".travis.yml"
85
- - Dockerfile
86
85
  - Gemfile
87
86
  - LICENSE.txt
88
87
  - README.md
@@ -164,8 +163,9 @@ files:
164
163
  - spec/dummy/vendor/assets/stylesheets/.keep
165
164
  - spec/spec_helper.rb
166
165
  - spec/validations/uniqueness_without_deleted_spec.rb
167
- homepage: ''
168
- licenses: []
166
+ homepage: https://github.com/anthonator/paranoia_uniqueness_validator
167
+ licenses:
168
+ - MIT
169
169
  metadata: {}
170
170
  post_install_message:
171
171
  rdoc_options: []
@@ -183,7 +183,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
183
183
  version: '0'
184
184
  requirements: []
185
185
  rubyforge_project:
186
- rubygems_version: 2.6.4
186
+ rubygems_version: 2.6.11
187
187
  signing_key:
188
188
  specification_version: 4
189
189
  summary: Validate unique fields without letting those pesky deleted records get in
data/Dockerfile DELETED
@@ -1,13 +0,0 @@
1
- FROM ruby:2.3
2
-
3
- MAINTAINER Anthony Smith <anthony@sticksnleaves.com>
4
-
5
- ENV APP_HOME /usr/src/app
6
-
7
- RUN apt-get update -y \
8
- && apt-get upgrade -y
9
-
10
- RUN gem install rubygems-update --no-document
11
- RUN gem install bundler --no-document
12
-
13
- WORKDIR $APP_HOME