paranoia 2.5.0 → 2.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/build.yml +8 -3
- data/CHANGELOG.md +22 -0
- data/Gemfile +6 -4
- data/README.md +1 -0
- data/lib/paranoia/rspec.rb +21 -18
- data/lib/paranoia/version.rb +1 -1
- data/lib/paranoia.rb +13 -3
- data/paranoia.gemspec +6 -1
- metadata +3 -4
- data/test/paranoia_test.rb +0 -1388
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3e8c766fdb37e4a9137f722b1ed77a34e7776d97c0f8a5e25f448e36c77fc332
|
4
|
+
data.tar.gz: 96087a09f51c030e0ae8c2262f0114b465aa7986231ce0ccc6458abe16b3d248
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3d5e2a067a77de1222ba94ebf07a6f62afc22fe4c700bbf6f5a56dbe45f0de4bde673574b0441986a2db917f8c2b592542f33cf559ba227fd6c0208dfaff9af6
|
7
|
+
data.tar.gz: 8374654630dea1028fa7b64eee00ff6abbc7ab0cbdce6b77c1fdcf34eac9aaf7df23d96f3aaa6915bf0c222169d8eccf6ec6024a0705195d43865326ece554bb
|
data/.github/workflows/build.yml
CHANGED
@@ -16,7 +16,8 @@ jobs:
|
|
16
16
|
fail-fast: false
|
17
17
|
matrix:
|
18
18
|
ruby:
|
19
|
-
|
19
|
+
- 3.1
|
20
|
+
- '3.0'
|
20
21
|
- 2.7
|
21
22
|
- 2.6
|
22
23
|
- 2.5
|
@@ -41,9 +42,13 @@ jobs:
|
|
41
42
|
ruby: 2.5
|
42
43
|
# Legacy Rails with newer rubies
|
43
44
|
- rails: '~> 5.1.0'
|
44
|
-
ruby: 3.0
|
45
|
+
ruby: '3.0'
|
45
46
|
- rails: '~> 5.2.0'
|
46
|
-
ruby: 3.0
|
47
|
+
ruby: '3.0'
|
48
|
+
- rails: '~> 5.1.0'
|
49
|
+
ruby: 3.1
|
50
|
+
- rails: '~> 5.2.0'
|
51
|
+
ruby: 3.1
|
47
52
|
|
48
53
|
env:
|
49
54
|
RAILS: ${{ matrix.rails }}
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,27 @@
|
|
1
1
|
# paranoia Changelog
|
2
2
|
|
3
|
+
## 2.5.2
|
4
|
+
|
5
|
+
* [#492](https://github.com/rubysherpas/paranoia/pull/492) Warn if acts_as_paranoid is called more than once on the same model
|
6
|
+
|
7
|
+
[Ignatius Reza](https://github.com/ignatiusreza)
|
8
|
+
|
9
|
+
## 2.5.1
|
10
|
+
|
11
|
+
* [#481](https://github.com/rubysherpas/paranoia/pull/481) Replaces hard coded `deleted_at` with `paranoia_column`.
|
12
|
+
|
13
|
+
[Hassanin Ahmed](https://github.com/sas1ni69)
|
14
|
+
|
15
|
+
## 2.5.0
|
16
|
+
|
17
|
+
* [#516](https://github.com/rubysherpas/paranoia/pull/516) Add support for ActiveRecord 7.0, drop support for EOL Ruby < 2.5 and Rails < 5.1
|
18
|
+
adding support for Rails 7
|
19
|
+
|
20
|
+
[Mathieu Jobin](https://github.com/mathieujobin)
|
21
|
+
* [#515](https://github.com/rubysherpas/paranoia/pull/515) Switch from Travis CI to GitHub Actions
|
22
|
+
|
23
|
+
[Shinichi Maeshima](https://github.com/willnet)
|
24
|
+
|
3
25
|
## 2.4.3
|
4
26
|
|
5
27
|
* [#503](https://github.com/rubysherpas/paranoia/pull/503) Bump activerecord dependency for Rails 6.1
|
data/Gemfile
CHANGED
@@ -12,10 +12,12 @@ platforms :jruby do
|
|
12
12
|
gem 'activerecord-jdbcsqlite3-adapter'
|
13
13
|
end
|
14
14
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
15
|
+
if RUBY_ENGINE == 'rbx'
|
16
|
+
platforms :rbx do
|
17
|
+
gem 'rubinius-developer_tools'
|
18
|
+
gem 'rubysl', '~> 2.0'
|
19
|
+
gem 'rubysl-test-unit'
|
20
|
+
end
|
19
21
|
end
|
20
22
|
|
21
23
|
rails = ENV['RAILS'] || '~> 5.2.0'
|
data/README.md
CHANGED
data/lib/paranoia/rspec.rb
CHANGED
@@ -1,23 +1,26 @@
|
|
1
|
-
|
1
|
+
if Rails.env.test?
|
2
|
+
require 'rspec/expectations'
|
2
3
|
|
3
|
-
# Validate the subject's class did call "acts_as_paranoid"
|
4
|
-
RSpec::Matchers.define :act_as_paranoid do
|
5
|
-
|
4
|
+
# Validate the subject's class did call "acts_as_paranoid"
|
5
|
+
RSpec::Matchers.define :act_as_paranoid do
|
6
|
+
match { |subject| subject.class.ancestors.include?(Paranoia) }
|
6
7
|
|
7
|
-
|
8
|
-
|
9
|
-
|
8
|
+
failure_message_proc = lambda do
|
9
|
+
"expected #{subject.class} to use `acts_as_paranoid`"
|
10
|
+
end
|
10
11
|
|
11
|
-
|
12
|
-
|
13
|
-
|
12
|
+
failure_message_when_negated_proc = lambda do
|
13
|
+
"expected #{subject.class} not to use `acts_as_paranoid`"
|
14
|
+
end
|
14
15
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
16
|
+
if respond_to?(:failure_message_when_negated)
|
17
|
+
failure_message(&failure_message_proc)
|
18
|
+
failure_message_when_negated(&failure_message_when_negated_proc)
|
19
|
+
else
|
20
|
+
# RSpec 2 compatibility:
|
21
|
+
failure_message_for_should(&failure_message_proc)
|
22
|
+
failure_message_for_should_not(&failure_message_when_negated_proc)
|
23
|
+
end
|
22
24
|
end
|
23
|
-
|
25
|
+
|
26
|
+
end
|
data/lib/paranoia/version.rb
CHANGED
data/lib/paranoia.rb
CHANGED
@@ -129,16 +129,16 @@ module Paranoia
|
|
129
129
|
def get_recovery_window_range(opts)
|
130
130
|
return opts[:recovery_window_range] if opts[:recovery_window_range]
|
131
131
|
return unless opts[:recovery_window]
|
132
|
-
(
|
132
|
+
(deletion_time - opts[:recovery_window]..deletion_time + opts[:recovery_window])
|
133
133
|
end
|
134
134
|
|
135
135
|
def within_recovery_window?(recovery_window_range)
|
136
136
|
return true unless recovery_window_range
|
137
|
-
recovery_window_range.cover?(
|
137
|
+
recovery_window_range.cover?(deletion_time)
|
138
138
|
end
|
139
139
|
|
140
140
|
def paranoia_destroyed?
|
141
|
-
|
141
|
+
deletion_time != paranoia_sentinel_value
|
142
142
|
end
|
143
143
|
alias :deleted? :paranoia_destroyed?
|
144
144
|
|
@@ -242,6 +242,12 @@ end
|
|
242
242
|
ActiveSupport.on_load(:active_record) do
|
243
243
|
class ActiveRecord::Base
|
244
244
|
def self.acts_as_paranoid(options={})
|
245
|
+
if included_modules.include?(Paranoia)
|
246
|
+
puts "[WARN] #{self.name} is calling acts_as_paranoid more than once!"
|
247
|
+
|
248
|
+
return
|
249
|
+
end
|
250
|
+
|
245
251
|
define_model_callbacks :restore, :real_destroy
|
246
252
|
|
247
253
|
alias_method :really_destroyed?, :destroyed?
|
@@ -293,6 +299,10 @@ ActiveSupport.on_load(:active_record) do
|
|
293
299
|
def paranoia_sentinel_value
|
294
300
|
self.class.paranoia_sentinel_value
|
295
301
|
end
|
302
|
+
|
303
|
+
def deletion_time
|
304
|
+
send(paranoia_column)
|
305
|
+
end
|
296
306
|
end
|
297
307
|
end
|
298
308
|
|
data/paranoia.gemspec
CHANGED
@@ -29,7 +29,12 @@ Gem::Specification.new do |s|
|
|
29
29
|
s.add_development_dependency "bundler", ">= 1.0.0"
|
30
30
|
s.add_development_dependency "rake"
|
31
31
|
|
32
|
-
|
32
|
+
|
33
|
+
s.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
34
|
+
files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)}) }
|
35
|
+
files
|
36
|
+
end
|
37
|
+
|
33
38
|
s.executables = `git ls-files`.split("\n").map{|f| f =~ /^bin\/(.*)/ ? $1 : nil}.compact
|
34
39
|
s.require_path = 'lib'
|
35
40
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: paranoia
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.5.
|
4
|
+
version: 2.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- radarlistener@gmail.com
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-02-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -87,7 +87,6 @@ files:
|
|
87
87
|
- lib/paranoia/rspec.rb
|
88
88
|
- lib/paranoia/version.rb
|
89
89
|
- paranoia.gemspec
|
90
|
-
- test/paranoia_test.rb
|
91
90
|
homepage: https://github.com/rubysherpas/paranoia
|
92
91
|
licenses:
|
93
92
|
- MIT
|
@@ -107,7 +106,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
107
106
|
- !ruby/object:Gem::Version
|
108
107
|
version: 1.3.6
|
109
108
|
requirements: []
|
110
|
-
rubygems_version: 3.
|
109
|
+
rubygems_version: 3.1.6
|
111
110
|
signing_key:
|
112
111
|
specification_version: 4
|
113
112
|
summary: Paranoia is a re-implementation of acts_as_paranoid for Rails 3, 4, and 5,
|