paranoia_uniqueness_validator 1.2.0 → 3.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (69) hide show
  1. checksums.yaml +5 -5
  2. data/.github/dependabot.yml +13 -0
  3. data/.github/workflows/ci.yml +46 -0
  4. data/.gitignore +4 -1
  5. data/Gemfile +13 -31
  6. data/README.md +19 -13
  7. data/lib/paranoia_uniqueness_validator/validations/uniqueness_without_deleted.rb +16 -14
  8. data/lib/paranoia_uniqueness_validator/version.rb +1 -1
  9. data/paranoia_uniqueness_validator.gemspec +6 -5
  10. data/spec/dummy/.gitignore +9 -3
  11. data/spec/dummy/.rspec +1 -0
  12. data/spec/dummy/{README.rdoc → README.md} +1 -5
  13. data/spec/dummy/Rakefile +2 -2
  14. data/spec/dummy/app/assets/config/manifest.js +3 -0
  15. data/spec/dummy/app/{mailers → assets/images}/.keep +0 -0
  16. data/spec/dummy/app/assets/javascripts/application.js +4 -4
  17. data/spec/dummy/app/assets/javascripts/cable.js +13 -0
  18. data/spec/dummy/app/{models → assets/javascripts/channels}/.keep +0 -0
  19. data/spec/dummy/app/assets/stylesheets/application.css +6 -4
  20. data/spec/dummy/app/channels/application_cable/channel.rb +4 -0
  21. data/spec/dummy/app/channels/application_cable/connection.rb +4 -0
  22. data/spec/dummy/app/controllers/application_controller.rb +0 -2
  23. data/spec/dummy/app/jobs/application_job.rb +2 -0
  24. data/spec/dummy/app/mailers/application_mailer.rb +4 -0
  25. data/spec/dummy/app/models/application_record.rb +3 -0
  26. data/spec/dummy/app/models/dummy_model.rb +1 -1
  27. data/spec/dummy/app/models/dummy_non_nil_model.rb +1 -1
  28. data/spec/dummy/app/views/layouts/application.html.erb +9 -9
  29. data/spec/dummy/app/views/layouts/mailer.html.erb +13 -0
  30. data/spec/dummy/app/views/layouts/mailer.text.erb +1 -0
  31. data/spec/dummy/bin/rails +1 -1
  32. data/spec/dummy/bin/setup +34 -0
  33. data/spec/dummy/bin/update +29 -0
  34. data/spec/dummy/config.ru +2 -1
  35. data/spec/dummy/config/application.rb +8 -10
  36. data/spec/dummy/config/boot.rb +3 -5
  37. data/spec/dummy/config/cable.yml +9 -0
  38. data/spec/dummy/config/database.yml +7 -11
  39. data/spec/dummy/config/environment.rb +4 -4
  40. data/spec/dummy/config/environments/development.rb +30 -5
  41. data/spec/dummy/config/environments/production.rb +37 -31
  42. data/spec/dummy/config/environments/test.rb +10 -4
  43. data/spec/dummy/config/initializers/application_controller_renderer.rb +6 -0
  44. data/spec/dummy/config/initializers/assets.rb +11 -0
  45. data/spec/dummy/config/initializers/cookies_serializer.rb +5 -0
  46. data/spec/dummy/config/initializers/mime_types.rb +0 -1
  47. data/spec/dummy/config/initializers/new_framework_defaults.rb +21 -0
  48. data/spec/dummy/config/initializers/session_store.rb +1 -1
  49. data/spec/dummy/config/initializers/wrap_parameters.rb +2 -2
  50. data/spec/dummy/config/puma.rb +47 -0
  51. data/spec/dummy/config/routes.rb +2 -48
  52. data/spec/dummy/config/secrets.yml +22 -0
  53. data/spec/dummy/config/spring.rb +6 -0
  54. data/spec/dummy/db/migrate/20130511080827_create_dummy_models.rb +1 -1
  55. data/spec/dummy/db/migrate/20160421194241_create_dummy_non_nil_models.rb +1 -1
  56. data/spec/dummy/db/schema.rb +5 -6
  57. data/spec/dummy/db/seeds.rb +3 -3
  58. data/spec/dummy/db/test.sqlite3 +0 -0
  59. data/spec/dummy/public/404.html +20 -11
  60. data/spec/dummy/public/422.html +20 -11
  61. data/spec/dummy/public/500.html +19 -10
  62. data/spec/dummy/public/apple-touch-icon-precomposed.png +0 -0
  63. data/spec/dummy/public/apple-touch-icon.png +0 -0
  64. data/spec/dummy/public/robots.txt +1 -1
  65. data/spec/spec_helper.rb +1 -2
  66. data/spec/validations/uniqueness_without_deleted_spec.rb +12 -15
  67. metadata +79 -32
  68. data/.travis.yml +0 -19
  69. data/spec/dummy/config/initializers/secret_token.rb +0 -12
@@ -5,43 +5,40 @@ require 'paranoia'
5
5
  describe ParanoiaUniquenessValidator::Validations::UniquenessWithoutDeletedValidator do
6
6
 
7
7
  context 'with nil default_sentinel_value' do
8
-
9
- before(:all) do
10
- Paranoia.default_sentinel_value = nil
11
- end
12
-
13
8
  it "should validate uniqueness" do
14
9
  DummyModel.create(:unique_field => "unique")
15
- DummyModel.new(:unique_field => "unique").should_not be_valid
10
+
11
+ expect(DummyModel.new(:unique_field => "unique")).to_not be_valid
16
12
  end
17
13
 
18
14
  it "should should be valid if not unique with a deleted record" do
19
15
  dummy_model = DummyModel.create(:unique_field => "unique")
20
16
  dummy_model.destroy
21
- dummy_model = DummyModel.new(:unique_field => "unique")
22
- dummy_model.should be_valid
23
- end
24
17
 
18
+ expect(DummyModel.new(:unique_field => "unique")).to be_valid
19
+ end
25
20
  end
26
21
 
27
22
  context 'with datetime (non nil) default_sentinel_value' do
28
-
29
23
  before(:all) do
30
- Paranoia.default_sentinel_value = DateTime.new(0)
24
+ if Paranoia.respond_to?(:default_sentinel_value)
25
+ Paranoia.default_sentinel_value = DateTime.new(0)
26
+ else
27
+ skip('Version of paranoia does not support default_sentinel_value')
28
+ end
31
29
  end
32
30
 
33
31
  it "should validate uniqueness" do
34
32
  DummyNonNilModel.create(:unique_field => "unique")
35
- DummyNonNilModel.new(:unique_field => "unique").should_not be_valid
33
+
34
+ expect(DummyNonNilModel.new(:unique_field => "unique")).to_not be_valid
36
35
  end
37
36
 
38
37
  it "should should be valid if not unique with a deleted record" do
39
38
  dummy_model = DummyNonNilModel.create(:unique_field => "unique")
40
39
  dummy_model.destroy
41
40
  dummy_model = DummyNonNilModel.new(:unique_field => "unique")
42
- dummy_model.should be_valid
41
+ expect(dummy_model).to be_valid
43
42
  end
44
-
45
43
  end
46
-
47
44
  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: 1.2.0
4
+ version: 3.3.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: 2016-04-27 00:00:00.000000000 Z
11
+ date: 2021-01-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -16,56 +16,62 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 4.0.0
19
+ version: 5.1.0
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: '6.2'
20
23
  type: :runtime
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
24
27
  - - ">="
25
28
  - !ruby/object:Gem::Version
26
- version: 4.0.0
29
+ version: 5.1.0
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: '6.2'
27
33
  - !ruby/object:Gem::Dependency
28
34
  name: paranoia
29
35
  requirement: !ruby/object:Gem::Requirement
30
36
  requirements:
31
- - - ">="
37
+ - - "~>"
32
38
  - !ruby/object:Gem::Version
33
- version: '0'
39
+ version: '2.3'
34
40
  type: :development
35
41
  prerelease: false
36
42
  version_requirements: !ruby/object:Gem::Requirement
37
43
  requirements:
38
- - - ">="
44
+ - - "~>"
39
45
  - !ruby/object:Gem::Version
40
- version: '0'
46
+ version: '2.3'
41
47
  - !ruby/object:Gem::Dependency
42
48
  name: database_cleaner
43
49
  requirement: !ruby/object:Gem::Requirement
44
50
  requirements:
45
- - - ">="
51
+ - - "~>"
46
52
  - !ruby/object:Gem::Version
47
- version: '0'
53
+ version: '1.6'
48
54
  type: :development
49
55
  prerelease: false
50
56
  version_requirements: !ruby/object:Gem::Requirement
51
57
  requirements:
52
- - - ">="
58
+ - - "~>"
53
59
  - !ruby/object:Gem::Version
54
- version: '0'
60
+ version: '1.6'
55
61
  - !ruby/object:Gem::Dependency
56
62
  name: rspec-rails
57
63
  requirement: !ruby/object:Gem::Requirement
58
64
  requirements:
59
- - - ">="
65
+ - - "~>"
60
66
  - !ruby/object:Gem::Version
61
- version: '0'
67
+ version: '4.0'
62
68
  type: :development
63
69
  prerelease: false
64
70
  version_requirements: !ruby/object:Gem::Requirement
65
71
  requirements:
66
- - - ">="
72
+ - - "~>"
67
73
  - !ruby/object:Gem::Version
68
- version: '0'
74
+ version: '4.0'
69
75
  description: Adds the validates_uniqueness_without_deleted validator to ignore deleted
70
76
  fields when validating for uniqueness.
71
77
  email:
@@ -74,8 +80,9 @@ executables: []
74
80
  extensions: []
75
81
  extra_rdoc_files: []
76
82
  files:
83
+ - ".github/dependabot.yml"
84
+ - ".github/workflows/ci.yml"
77
85
  - ".gitignore"
78
- - ".travis.yml"
79
86
  - Gemfile
80
87
  - LICENSE.txt
81
88
  - README.md
@@ -86,39 +93,57 @@ files:
86
93
  - paranoia_uniqueness_validator.gemspec
87
94
  - spec/dummy/.gitignore
88
95
  - spec/dummy/.rspec
89
- - spec/dummy/README.rdoc
96
+ - spec/dummy/README.md
90
97
  - spec/dummy/Rakefile
98
+ - spec/dummy/app/assets/config/manifest.js
99
+ - spec/dummy/app/assets/images/.keep
91
100
  - spec/dummy/app/assets/javascripts/application.js
101
+ - spec/dummy/app/assets/javascripts/cable.js
102
+ - spec/dummy/app/assets/javascripts/channels/.keep
92
103
  - spec/dummy/app/assets/stylesheets/application.css
104
+ - spec/dummy/app/channels/application_cable/channel.rb
105
+ - spec/dummy/app/channels/application_cable/connection.rb
93
106
  - spec/dummy/app/controllers/application_controller.rb
94
107
  - spec/dummy/app/controllers/concerns/.keep
95
108
  - spec/dummy/app/helpers/application_helper.rb
96
- - spec/dummy/app/mailers/.keep
97
- - spec/dummy/app/models/.keep
109
+ - spec/dummy/app/jobs/application_job.rb
110
+ - spec/dummy/app/mailers/application_mailer.rb
111
+ - spec/dummy/app/models/application_record.rb
98
112
  - spec/dummy/app/models/concerns/.keep
99
113
  - spec/dummy/app/models/dummy_model.rb
100
114
  - spec/dummy/app/models/dummy_non_nil_model.rb
101
115
  - spec/dummy/app/views/layouts/application.html.erb
116
+ - spec/dummy/app/views/layouts/mailer.html.erb
117
+ - spec/dummy/app/views/layouts/mailer.text.erb
102
118
  - spec/dummy/bin/bundle
103
119
  - spec/dummy/bin/rails
104
120
  - spec/dummy/bin/rake
121
+ - spec/dummy/bin/setup
122
+ - spec/dummy/bin/update
105
123
  - spec/dummy/config.ru
106
124
  - spec/dummy/config/application.rb
107
125
  - spec/dummy/config/boot.rb
126
+ - spec/dummy/config/cable.yml
108
127
  - spec/dummy/config/database.yml
109
128
  - spec/dummy/config/environment.rb
110
129
  - spec/dummy/config/environments/development.rb
111
130
  - spec/dummy/config/environments/production.rb
112
131
  - spec/dummy/config/environments/test.rb
132
+ - spec/dummy/config/initializers/application_controller_renderer.rb
133
+ - spec/dummy/config/initializers/assets.rb
113
134
  - spec/dummy/config/initializers/backtrace_silencers.rb
135
+ - spec/dummy/config/initializers/cookies_serializer.rb
114
136
  - spec/dummy/config/initializers/filter_parameter_logging.rb
115
137
  - spec/dummy/config/initializers/inflections.rb
116
138
  - spec/dummy/config/initializers/mime_types.rb
117
- - spec/dummy/config/initializers/secret_token.rb
139
+ - spec/dummy/config/initializers/new_framework_defaults.rb
118
140
  - spec/dummy/config/initializers/session_store.rb
119
141
  - spec/dummy/config/initializers/wrap_parameters.rb
120
142
  - spec/dummy/config/locales/en.yml
143
+ - spec/dummy/config/puma.rb
121
144
  - spec/dummy/config/routes.rb
145
+ - spec/dummy/config/secrets.yml
146
+ - spec/dummy/config/spring.rb
122
147
  - spec/dummy/db/migrate/20130511080827_create_dummy_models.rb
123
148
  - spec/dummy/db/migrate/20160421194241_create_dummy_non_nil_models.rb
124
149
  - spec/dummy/db/schema.rb
@@ -130,16 +155,19 @@ files:
130
155
  - spec/dummy/public/404.html
131
156
  - spec/dummy/public/422.html
132
157
  - spec/dummy/public/500.html
158
+ - spec/dummy/public/apple-touch-icon-precomposed.png
159
+ - spec/dummy/public/apple-touch-icon.png
133
160
  - spec/dummy/public/favicon.ico
134
161
  - spec/dummy/public/robots.txt
135
162
  - spec/dummy/vendor/assets/javascripts/.keep
136
163
  - spec/dummy/vendor/assets/stylesheets/.keep
137
164
  - spec/spec_helper.rb
138
165
  - spec/validations/uniqueness_without_deleted_spec.rb
139
- homepage: ''
140
- licenses: []
166
+ homepage: https://github.com/anthonator/paranoia_uniqueness_validator
167
+ licenses:
168
+ - MIT
141
169
  metadata: {}
142
- post_install_message:
170
+ post_install_message:
143
171
  rdoc_options: []
144
172
  require_paths:
145
173
  - lib
@@ -154,48 +182,65 @@ required_rubygems_version: !ruby/object:Gem::Requirement
154
182
  - !ruby/object:Gem::Version
155
183
  version: '0'
156
184
  requirements: []
157
- rubyforge_project:
158
- rubygems_version: 2.5.1
159
- signing_key:
185
+ rubygems_version: 3.1.2
186
+ signing_key:
160
187
  specification_version: 4
161
188
  summary: Validate unique fields without letting those pesky deleted records get in
162
189
  the way. Great for use with Paranoia.
163
190
  test_files:
164
191
  - spec/dummy/.gitignore
165
192
  - spec/dummy/.rspec
166
- - spec/dummy/README.rdoc
193
+ - spec/dummy/README.md
167
194
  - spec/dummy/Rakefile
195
+ - spec/dummy/app/assets/config/manifest.js
196
+ - spec/dummy/app/assets/images/.keep
168
197
  - spec/dummy/app/assets/javascripts/application.js
198
+ - spec/dummy/app/assets/javascripts/cable.js
199
+ - spec/dummy/app/assets/javascripts/channels/.keep
169
200
  - spec/dummy/app/assets/stylesheets/application.css
201
+ - spec/dummy/app/channels/application_cable/channel.rb
202
+ - spec/dummy/app/channels/application_cable/connection.rb
170
203
  - spec/dummy/app/controllers/application_controller.rb
171
204
  - spec/dummy/app/controllers/concerns/.keep
172
205
  - spec/dummy/app/helpers/application_helper.rb
173
- - spec/dummy/app/mailers/.keep
174
- - spec/dummy/app/models/.keep
206
+ - spec/dummy/app/jobs/application_job.rb
207
+ - spec/dummy/app/mailers/application_mailer.rb
208
+ - spec/dummy/app/models/application_record.rb
175
209
  - spec/dummy/app/models/concerns/.keep
176
210
  - spec/dummy/app/models/dummy_model.rb
177
211
  - spec/dummy/app/models/dummy_non_nil_model.rb
178
212
  - spec/dummy/app/views/layouts/application.html.erb
213
+ - spec/dummy/app/views/layouts/mailer.html.erb
214
+ - spec/dummy/app/views/layouts/mailer.text.erb
179
215
  - spec/dummy/bin/bundle
180
216
  - spec/dummy/bin/rails
181
217
  - spec/dummy/bin/rake
218
+ - spec/dummy/bin/setup
219
+ - spec/dummy/bin/update
182
220
  - spec/dummy/config.ru
183
221
  - spec/dummy/config/application.rb
184
222
  - spec/dummy/config/boot.rb
223
+ - spec/dummy/config/cable.yml
185
224
  - spec/dummy/config/database.yml
186
225
  - spec/dummy/config/environment.rb
187
226
  - spec/dummy/config/environments/development.rb
188
227
  - spec/dummy/config/environments/production.rb
189
228
  - spec/dummy/config/environments/test.rb
229
+ - spec/dummy/config/initializers/application_controller_renderer.rb
230
+ - spec/dummy/config/initializers/assets.rb
190
231
  - spec/dummy/config/initializers/backtrace_silencers.rb
232
+ - spec/dummy/config/initializers/cookies_serializer.rb
191
233
  - spec/dummy/config/initializers/filter_parameter_logging.rb
192
234
  - spec/dummy/config/initializers/inflections.rb
193
235
  - spec/dummy/config/initializers/mime_types.rb
194
- - spec/dummy/config/initializers/secret_token.rb
236
+ - spec/dummy/config/initializers/new_framework_defaults.rb
195
237
  - spec/dummy/config/initializers/session_store.rb
196
238
  - spec/dummy/config/initializers/wrap_parameters.rb
197
239
  - spec/dummy/config/locales/en.yml
240
+ - spec/dummy/config/puma.rb
198
241
  - spec/dummy/config/routes.rb
242
+ - spec/dummy/config/secrets.yml
243
+ - spec/dummy/config/spring.rb
199
244
  - spec/dummy/db/migrate/20130511080827_create_dummy_models.rb
200
245
  - spec/dummy/db/migrate/20160421194241_create_dummy_non_nil_models.rb
201
246
  - spec/dummy/db/schema.rb
@@ -207,6 +252,8 @@ test_files:
207
252
  - spec/dummy/public/404.html
208
253
  - spec/dummy/public/422.html
209
254
  - spec/dummy/public/500.html
255
+ - spec/dummy/public/apple-touch-icon-precomposed.png
256
+ - spec/dummy/public/apple-touch-icon.png
210
257
  - spec/dummy/public/favicon.ico
211
258
  - spec/dummy/public/robots.txt
212
259
  - spec/dummy/vendor/assets/javascripts/.keep
@@ -1,19 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - 1.9.3
4
- - 2.0.0
5
- - 2.1.0
6
- - 2.2.0
7
- - ruby-head
8
- - jruby-19mode
9
- - jruby-head
10
- - rbx
11
- env:
12
- - "RAILS_VERSION=4.0.0"
13
- - "RAILS_VERSION=4.1.0"
14
- - "RAILS_VERSION=4.2.0"
15
- matrix:
16
- allow_failures:
17
- - rvm: ruby-head
18
- - rvm: jruby-head
19
- sudo: false
@@ -1,12 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
-
3
- # Your secret key is used for verifying the integrity of signed cookies.
4
- # If you change this key, all old signed cookies will become invalid!
5
-
6
- # Make sure the secret is at least 30 characters and all random,
7
- # no regular words or you'll be exposed to dictionary attacks.
8
- # You can use `rake secret` to generate a secure secret key.
9
-
10
- # Make sure your secret_key_base is kept private
11
- # if you're sharing your code publicly.
12
- Dummy::Application.config.secret_key_base = '2a1e6d792dd39b4e90fa2824333f03c90231a3fabd9cb3d3a284afc5844333f50b53c0db33bfa98f01d97451c227b27c7b716ac6628cda837129e68fbce6c948'