paranoia_uniqueness_validator 3.0.0 → 3.4.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
- SHA1:
3
- metadata.gz: ad82f8dc3a747d34926d95905b6194f554db18f6
4
- data.tar.gz: b5a9e10595083c04576275f1a6ddb99ed1091ea8
2
+ SHA256:
3
+ metadata.gz: 24b40b3583d12102adc5d8219dd4f06e68249aeccc664e47e6ce3709946b17ad
4
+ data.tar.gz: 360f028d6f25aec3d413b33131b5597cc59f0c81d4bd00a1f234cb49a27fec6d
5
5
  SHA512:
6
- metadata.gz: 6d0780ebd71e952aaabbd1de3101d6fe86b22b8154c190e038f05e4a1841d27efdb92ecdd7487887d7443641fa62cc2c6734d8e1da7348e678137842b015c15a
7
- data.tar.gz: 12e46e861c058e500e3273711287d4c59501a9e5f294be2b325c94287a7fd7a13b50d97a5cb1523a14976aa0f88d592a6f2c5ad70dee9006651b832c6e96c493
6
+ metadata.gz: f4800580592d9914cc720033db5690634e66237f8e7a32dd68a2b08feac8e3a4bd6558da2b51b3f8bd8acc9094256d08befca3b3fca182daadce26ba05da11a9
7
+ data.tar.gz: dd5f9742b7fb78863f9a6ffb8ec135f7c52fa4224be6443c45fb13952b27f55700e93889ff5d69d8dc26d9db2170410bc94a999f7baf1cd4c0f7873316f8a706
@@ -0,0 +1,12 @@
1
+ version: 2
2
+
3
+ updates:
4
+ - directory: /
5
+
6
+ package-ecosystem: bundler
7
+
8
+ schedule:
9
+ interval: daily
10
+
11
+ target-branch: main
12
+
@@ -0,0 +1,86 @@
1
+ name: ci
2
+
3
+ on: [push, pull_request]
4
+
5
+ jobs:
6
+ test:
7
+ if: github.actor != 'dependabot[bot]' && github.event_name == 'push' ||
8
+ github.event_name == 'pull_request'
9
+
10
+ strategy:
11
+ matrix:
12
+ rails: ['5.2', '6.0', '6.1', '7.0', 'master']
13
+
14
+ ruby: ['2.6', '2.7', '3.0', '3.1']
15
+
16
+ exclude:
17
+ - rails: master
18
+
19
+ ruby: '2.6'
20
+
21
+ - rails: '7.0'
22
+
23
+ ruby: '2.6'
24
+
25
+ - rails: '7.0'
26
+
27
+ ruby: '3.1'
28
+
29
+ - rails: '6.0'
30
+
31
+ ruby: '3.0'
32
+
33
+ - rails: '6.0'
34
+
35
+ ruby: '3.1'
36
+
37
+ - rails: '5.2'
38
+
39
+ ruby: '2.7'
40
+
41
+ - rails: '5.2'
42
+
43
+ ruby: '3.0'
44
+
45
+ - rails: '5.2'
46
+
47
+ ruby: '3.1'
48
+
49
+ runs-on: ubuntu-latest
50
+
51
+ steps:
52
+ - uses: actions/checkout@v2
53
+
54
+ - uses: ruby/setup-ruby@v1
55
+
56
+ with:
57
+ ruby-version: ${{ matrix.ruby }}
58
+
59
+ - name: Install toolchain
60
+
61
+ run: |
62
+ sudo apt-get update
63
+
64
+ sudo apt-get install \
65
+ build-essential \
66
+ libsqlite3-dev
67
+
68
+ - name: Install bundler
69
+
70
+ run: gem install bundler
71
+
72
+ - env:
73
+ RAILS_VERSION: ${{ matrix.rails }}
74
+
75
+ name: Install dependencies
76
+
77
+ run: bundle install
78
+
79
+ - env:
80
+ RAILS_VERSION: ${{ matrix.rails }}
81
+
82
+ name: Test
83
+
84
+ run: bundle exec rspec
85
+
86
+
data/Gemfile CHANGED
@@ -5,35 +5,23 @@ gemspec
5
5
 
6
6
  rails_version = ENV['RAILS_VERSION'] || 'default'
7
7
 
8
- rails = case rails_version
9
-
10
- when 'master'
11
- { github: 'rails/rails' }
12
- when 'default'
13
- '>= 5.1.0'
14
- else
15
- "~> #{rails_version}"
16
- end
8
+ rails =
9
+ case rails_version
10
+ when 'master'
11
+ { github: 'rails/rails' }
12
+ when 'default'
13
+ '>= 7.0'
14
+ else
15
+ "~> #{rails_version}"
16
+ end
17
17
 
18
18
  gem 'rails', rails
19
19
 
20
- platforms :jruby do
21
- gem "activerecord-jdbcsqlite3-adapter"
22
- gem "jruby-openssl"
23
- end
24
-
25
- platforms :ruby do
26
- gem "sqlite3"
27
- gem "test-unit"
28
- end
29
-
30
- platforms :ruby_19, :jruby_19 do
31
- gem "mime-types", "< 3.0"
32
- end
33
-
34
20
  group :development do
35
21
  gem 'bundler'
36
- gem 'coveralls', :require => false
22
+ gem 'coveralls', require: false
37
23
  gem 'listen'
38
24
  gem 'rake'
25
+ gem 'sqlite3'
26
+ gem 'test-unit'
39
27
  end
data/README.md CHANGED
@@ -1,10 +1,13 @@
1
1
  # ParanoiaUniquenessValidator
2
2
 
3
- Adds validator validates_uniqueness_without_deleted.
3
+ Adds `validates_uniqueness_without_deleted`.
4
4
 
5
- This validator will ignore any record that has a non-null value for the deleted_at field. This gem was made specifically for use with the [Paranoia](https://github.com/radar/paranoia) gem but it can be used with any gem that uses the deleted_at field for marking records as deleted.
5
+ This validator will ignore any record that has a non-null value for the
6
+ `deleted_at` field. This gem was made specifically for use with the
7
+ [Paranoia](https://github.com/radar/paranoia) gem but it can be used with any
8
+ gem that uses the `deleted_at` field for marking records as deleted.
6
9
 
7
- [![Gem Version](https://badge.fury.io/rb/paranoia_uniqueness_validator.png)](http://badge.fury.io/rb/paranoia_uniqueness_validator) [![Build Status](https://secure.travis-ci.org/anthonator/paranoia_uniqueness_validator.png)](http://travis-ci.org/anthonator/paranoia_uniqueness_validator) [![Dependency Status](https://gemnasium.com/anthonator/paranoia_uniqueness_validator.png)](https://gemnasium.com/anthonator/paranoia_uniqueness_validator) [![Coverage Status](https://coveralls.io/repos/anthonator/paranoia_uniqueness_validator/badge.png)](https://coveralls.io/r/anthonator/paranoia_uniqueness_validator) [![Code Climate](https://codeclimate.com/github/anthonator/paranoia_uniqueness_validator.png)](https://codeclimate.com/github/anthonator/paranoia_uniqueness_validator)
10
+ [![Gem Version](https://badge.fury.io/rb/paranoia_uniqueness_validator.png)](http://badge.fury.io/rb/paranoia_uniqueness_validator) ![ci](https://github.com/anthonator/paranoia_uniqueness_validator/workflows/ci/badge.svg) [![Coverage Status](https://coveralls.io/repos/anthonator/paranoia_uniqueness_validator/badge.png)](https://coveralls.io/r/anthonator/paranoia_uniqueness_validator) [![Code Climate](https://codeclimate.com/github/anthonator/paranoia_uniqueness_validator.png)](https://codeclimate.com/github/anthonator/paranoia_uniqueness_validator)
8
11
 
9
12
  ## Installation
10
13
 
@@ -20,7 +23,13 @@ Add this line to your application's Gemfile:
20
23
  gem 'paranoia_uniqueness_validator', '2.0.0'
21
24
 
22
25
  # Rails 5.1
23
- gem 'paranoia_uniqueness_validator', '3.0.0'
26
+ gem 'paranoia_uniqueness_validator', '3.1.0'
27
+
28
+ # Rails 6
29
+ gem 'paranoia_uniqueness_validator', '3.3.0'
30
+
31
+ # Rails 7
32
+ gem 'paranoia_uniqueness_validator', '3.4.0'
24
33
 
25
34
  And then execute:
26
35
 
@@ -32,13 +41,14 @@ Or install it yourself as:
32
41
 
33
42
  ## Configuration
34
43
 
35
- This validator supports all configuration options used by the base ActiveRecord uniqueness validator. For more information check out the [Rails API documentation](http://api.rubyonrails.org/classes/ActiveRecord/Validations/ClassMethods.html#method-i-validates_uniqueness_of).
44
+ This validator supports all configuration options used by the base ActiveRecord
45
+ uniqueness validator. For more information check out the [Rails API documentation](http://api.rubyonrails.org/classes/ActiveRecord/Validations/ClassMethods.html#method-i-validates_uniqueness_of).
36
46
 
37
47
  ## Usage
38
48
 
39
49
  ```ruby
40
50
  class SomeModel < ActiveRecord::Base
41
- validates :some_field, :uniqueness_without_deleted => true
51
+ validates :some_field, uniqueness_without_deleted: true
42
52
  end
43
53
  ```
44
54
 
@@ -49,11 +59,3 @@ end
49
59
  3. Commit your changes (`git commit -am 'Add some feature'`)
50
60
  4. Push to the branch (`git push origin my-new-feature`)
51
61
  5. Create new Pull Request
52
-
53
- ## Credits
54
-
55
- [![Sticksnleaves](http://sticksnleaves-wordpress.herokuapp.com/wp-content/themes/sticksnleaves/images/snl-logo-116x116.png)](http://www.sticksnleaves.com)
56
-
57
- paranoia_uniqueness_validator is maintained and funded by [Sticksnleaves](http://www.sticksnleaves.com)
58
-
59
- Thanks to all of our [contributors](https://github.com/anthonator/paranoia_uniqueness_validator/graphs/contributors)
@@ -28,7 +28,7 @@ module ParanoiaUniquenessValidator
28
28
  error_options = options.except(:case_sensitive, :scope, :conditions)
29
29
  error_options[:value] = value
30
30
 
31
- record.errors.add(attribute, :taken, error_options)
31
+ record.errors.add(attribute, :taken, **error_options)
32
32
  end
33
33
  end
34
34
  end
@@ -1,3 +1,3 @@
1
1
  module ParanoiaUniquenessValidator
2
- VERSION = "3.0.0"
2
+ VERSION = "3.4.0"
3
3
  end
@@ -6,21 +6,21 @@ require 'paranoia_uniqueness_validator/version'
6
6
  Gem::Specification.new do |gem|
7
7
  gem.name = "paranoia_uniqueness_validator"
8
8
  gem.version = ParanoiaUniquenessValidator::VERSION
9
+ gem.licenses = ['MIT']
9
10
  gem.authors = ["Anthony Smith"]
10
11
  gem.email = ["anthony@sticksnleaves.com"]
11
12
  gem.description = %q{Adds the validates_uniqueness_without_deleted validator to ignore deleted fields when validating for uniqueness.}
12
13
  gem.summary = %q{Validate unique fields without letting those pesky deleted records get in the way. Great for use with Paranoia.}
13
14
  gem.homepage = "https://github.com/anthonator/paranoia_uniqueness_validator"
14
- gem.license = "MIT"
15
15
 
16
16
  gem.files = `git ls-files`.split($/)
17
17
  gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
18
18
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
19
19
  gem.require_paths = ["lib"]
20
20
 
21
- gem.add_dependency "activerecord", ">= 5.1.0", "< 5.2"
21
+ gem.add_dependency "activerecord", ">= 5.2.0", "< 7.1"
22
22
 
23
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"
24
+ gem.add_development_dependency "database_cleaner", "~> 2.0"
25
+ gem.add_development_dependency "rspec-rails", "~> 5.0"
26
26
  end
@@ -3,13 +3,13 @@ require_relative 'boot'
3
3
  require "rails"
4
4
  # Pick the frameworks you want:
5
5
  require "active_model/railtie"
6
- require "active_job/railtie"
6
+ # require "active_job/railtie"
7
7
  require "active_record/railtie"
8
- require "action_controller/railtie"
9
- require "action_mailer/railtie"
10
- require "action_view/railtie"
11
- require "action_cable/engine"
12
- require "sprockets/railtie"
8
+ # require "action_controller/railtie"
9
+ # require "action_mailer/railtie"
10
+ # require "action_view/railtie"
11
+ # require "action_cable/engine"
12
+ # require "sprockets/railtie"
13
13
  # require "rails/test_unit/railtie"
14
14
 
15
15
  # Require the gems listed in Gemfile, including any gems
@@ -14,22 +14,22 @@ Rails.application.configure do
14
14
 
15
15
  # Enable/disable caching. By default caching is disabled.
16
16
  if Rails.root.join('tmp/caching-dev.txt').exist?
17
- config.action_controller.perform_caching = true
17
+ # config.action_controller.perform_caching = true
18
18
 
19
19
  config.cache_store = :memory_store
20
20
  config.public_file_server.headers = {
21
21
  'Cache-Control' => 'public, max-age=172800'
22
22
  }
23
23
  else
24
- config.action_controller.perform_caching = false
24
+ # config.action_controller.perform_caching = false
25
25
 
26
26
  config.cache_store = :null_store
27
27
  end
28
28
 
29
29
  # Don't care if the mailer can't send.
30
- config.action_mailer.raise_delivery_errors = false
30
+ # config.action_mailer.raise_delivery_errors = false
31
31
 
32
- config.action_mailer.perform_caching = false
32
+ # config.action_mailer.perform_caching = false
33
33
 
34
34
  # Print deprecation notices to the Rails logger.
35
35
  config.active_support.deprecation = :log
@@ -40,10 +40,10 @@ Rails.application.configure do
40
40
  # Debug mode disables concatenation and preprocessing of assets.
41
41
  # This option may cause significant delays in view rendering with a large
42
42
  # number of complex assets.
43
- config.assets.debug = true
43
+ # config.assets.debug = true
44
44
 
45
45
  # Suppress logger output for asset requests.
46
- config.assets.quiet = true
46
+ # config.assets.quiet = true
47
47
 
48
48
  # Raises error for missing translations
49
49
  # config.action_view.raise_on_missing_translations = true
@@ -12,18 +12,18 @@ Rails.application.configure do
12
12
 
13
13
  # Full error reports are disabled and caching is turned on.
14
14
  config.consider_all_requests_local = false
15
- config.action_controller.perform_caching = true
15
+ # config.action_controller.perform_caching = true
16
16
 
17
17
  # Disable serving static files from the `/public` folder by default since
18
18
  # Apache or NGINX already handles this.
19
19
  config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
20
20
 
21
21
  # Compress JavaScripts and CSS.
22
- config.assets.js_compressor = :uglifier
22
+ # config.assets.js_compressor = :uglifier
23
23
  # config.assets.css_compressor = :sass
24
24
 
25
25
  # Do not fallback to assets pipeline if a precompiled asset is missed.
26
- config.assets.compile = false
26
+ # config.assets.compile = false
27
27
 
28
28
  # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
29
29
 
@@ -20,19 +20,19 @@ Rails.application.configure do
20
20
 
21
21
  # Show full error reports and disable caching.
22
22
  config.consider_all_requests_local = true
23
- config.action_controller.perform_caching = false
23
+ # config.action_controller.perform_caching = false
24
24
 
25
25
  # Raise exceptions instead of rendering exception templates.
26
26
  config.action_dispatch.show_exceptions = false
27
27
 
28
28
  # Disable request forgery protection in test environment.
29
- config.action_controller.allow_forgery_protection = false
30
- config.action_mailer.perform_caching = false
29
+ # config.action_controller.allow_forgery_protection = false
30
+ # config.action_mailer.perform_caching = false
31
31
 
32
32
  # Tell Action Mailer not to deliver emails to the real world.
33
33
  # The :test delivery method accumulates sent emails in the
34
34
  # ActionMailer::Base.deliveries array.
35
- config.action_mailer.delivery_method = :test
35
+ # config.action_mailer.delivery_method = :test
36
36
 
37
37
  # Print deprecation notices to the stderr.
38
38
  config.active_support.deprecation = :stderr
@@ -1,7 +1,7 @@
1
1
  # Be sure to restart your server when you modify this file.
2
2
 
3
3
  # Version of your assets, change this if you want to expire all your assets.
4
- Rails.application.config.assets.version = '1.0'
4
+ # Rails.application.config.assets.version = '1.0'
5
5
 
6
6
  # Add additional assets to the asset load path
7
7
  # Rails.application.config.assets.paths << Emoji.images_path
@@ -3,7 +3,6 @@ require 'paranoia'
3
3
 
4
4
 
5
5
  describe ParanoiaUniquenessValidator::Validations::UniquenessWithoutDeletedValidator do
6
-
7
6
  context 'with nil default_sentinel_value' do
8
7
  it "should validate uniqueness" do
9
8
  DummyModel.create(:unique_field => "unique")
@@ -17,11 +16,9 @@ describe ParanoiaUniquenessValidator::Validations::UniquenessWithoutDeletedValid
17
16
 
18
17
  expect(DummyModel.new(:unique_field => "unique")).to be_valid
19
18
  end
20
-
21
19
  end
22
20
 
23
21
  context 'with datetime (non nil) default_sentinel_value' do
24
-
25
22
  before(:all) do
26
23
  if Paranoia.respond_to?(:default_sentinel_value)
27
24
  Paranoia.default_sentinel_value = DateTime.new(0)
@@ -42,7 +39,5 @@ describe ParanoiaUniquenessValidator::Validations::UniquenessWithoutDeletedValid
42
39
  dummy_model = DummyNonNilModel.new(:unique_field => "unique")
43
40
  expect(dummy_model).to be_valid
44
41
  end
45
-
46
42
  end
47
-
48
43
  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: 3.0.0
4
+ version: 3.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anthony Smith
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-05-10 00:00:00.000000000 Z
11
+ date: 2022-01-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -16,20 +16,20 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 5.1.0
19
+ version: 5.2.0
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
- version: '5.2'
22
+ version: '7.1'
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.1.0
29
+ version: 5.2.0
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
- version: '5.2'
32
+ version: '7.1'
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: paranoia
35
35
  requirement: !ruby/object:Gem::Requirement
@@ -50,28 +50,28 @@ dependencies:
50
50
  requirements:
51
51
  - - "~>"
52
52
  - !ruby/object:Gem::Version
53
- version: '1.6'
53
+ version: '2.0'
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: '1.6'
60
+ version: '2.0'
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: '3.6'
67
+ version: '5.0'
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: '3.6'
74
+ version: '5.0'
75
75
  description: Adds the validates_uniqueness_without_deleted validator to ignore deleted
76
76
  fields when validating for uniqueness.
77
77
  email:
@@ -80,13 +80,13 @@ executables: []
80
80
  extensions: []
81
81
  extra_rdoc_files: []
82
82
  files:
83
+ - ".github/dependabot.yaml"
84
+ - ".github/workflows/ci.yaml"
83
85
  - ".gitignore"
84
- - ".travis.yml"
85
86
  - Gemfile
86
87
  - LICENSE.txt
87
88
  - README.md
88
89
  - Rakefile
89
- - docker-compose.yml
90
90
  - lib/paranoia_uniqueness_validator.rb
91
91
  - lib/paranoia_uniqueness_validator/validations/uniqueness_without_deleted.rb
92
92
  - lib/paranoia_uniqueness_validator/version.rb
@@ -167,7 +167,7 @@ homepage: https://github.com/anthonator/paranoia_uniqueness_validator
167
167
  licenses:
168
168
  - MIT
169
169
  metadata: {}
170
- post_install_message:
170
+ post_install_message:
171
171
  rdoc_options: []
172
172
  require_paths:
173
173
  - lib
@@ -182,9 +182,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
182
182
  - !ruby/object:Gem::Version
183
183
  version: '0'
184
184
  requirements: []
185
- rubyforge_project:
186
- rubygems_version: 2.6.11
187
- signing_key:
185
+ rubygems_version: 3.3.3
186
+ signing_key:
188
187
  specification_version: 4
189
188
  summary: Validate unique fields without letting those pesky deleted records get in
190
189
  the way. Great for use with Paranoia.
data/.travis.yml DELETED
@@ -1,16 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - 2.2.5
4
- - 2.3.0
5
- - 2.4.0
6
- - ruby-head
7
- - jruby-head
8
- env:
9
- - "RAILS_VERSION=master"
10
- - "RAILS_VERSION=5.1.0"
11
- matrix:
12
- allow_failures:
13
- - rvm: ruby-head
14
- - rvm: jruby-head
15
- - env: RAILS_VERSION=master
16
- sudo: false
data/docker-compose.yml DELETED
@@ -1,11 +0,0 @@
1
- version: '2'
2
- services:
3
- lib:
4
- command: rspec
5
- image: sticksnleaves/ruby-project:2.4
6
- volumes:
7
- - .:/usr/src/app
8
- - lib.volume:/usr/local/bundle
9
- volumes:
10
- lib.volume:
11
- driver: local