storage_unit 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/Guardfile +9 -0
- data/lib/storage_unit/core.rb +2 -2
- data/lib/storage_unit/version.rb +1 -1
- data/spec/storage_unit_spec.rb +7 -1
- data/storage_unit.gemspec +1 -0
- metadata +19 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eba1b54d63d57e4b4b4e2149754272ac180cce08
|
4
|
+
data.tar.gz: 4754737dec10ea3d2e116926cc31349315b4791d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a650824e8575059391dedbf25751f2ae5ad738d4678a65cdc599a94c87f985548d40acde3bcd59703f7a996304e2a5ba0ede390d1a8360a974b51c375c8e8996
|
7
|
+
data.tar.gz: c6247d85de6378b7f2850d73cbd748cbe57741c09a6ab744658203a86019a4869394fe181ec3e86336284c063d3bd9f6e05690af3a0a88734e15e1fd34671b96
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.3.0
|
data/Guardfile
ADDED
data/lib/storage_unit/core.rb
CHANGED
@@ -34,7 +34,7 @@ module StorageUnit
|
|
34
34
|
end
|
35
35
|
|
36
36
|
def trash_dependents
|
37
|
-
storage_unit_opts[:cascade].each do |x|
|
37
|
+
Array(storage_unit_opts[:cascade]).each do |x|
|
38
38
|
send(x).update_all trash_hash(DateTime.now)
|
39
39
|
end
|
40
40
|
end
|
@@ -47,7 +47,7 @@ module StorageUnit
|
|
47
47
|
end
|
48
48
|
|
49
49
|
def recover_dependents
|
50
|
-
storage_unit_opts[:cascade].each do |x|
|
50
|
+
Array(storage_unit_opts[:cascade]).each do |x|
|
51
51
|
send(x).with_deleted.update_all trash_hash(nil)
|
52
52
|
end
|
53
53
|
end
|
data/lib/storage_unit/version.rb
CHANGED
data/spec/storage_unit_spec.rb
CHANGED
@@ -19,7 +19,7 @@ end
|
|
19
19
|
class UserWithNote < ActiveRecord::Base
|
20
20
|
self.table_name = 'users'
|
21
21
|
has_many :notes, class_name: 'NoteForUser', foreign_key: 'user_id'
|
22
|
-
has_storage_unit cascade:
|
22
|
+
has_storage_unit cascade: :notes
|
23
23
|
end
|
24
24
|
|
25
25
|
class NoteForUser < TrashableNote
|
@@ -82,6 +82,12 @@ describe 'Default scope' do
|
|
82
82
|
user.update deleted_at: Time.now
|
83
83
|
expect(User.with_deleted.count).to eq 1
|
84
84
|
end
|
85
|
+
|
86
|
+
it 'can be overriden with a block' do
|
87
|
+
user.update deleted_at: Time.now
|
88
|
+
expect { User.find(user.id) }.to raise_error(ActiveRecord::RecordNotFound)
|
89
|
+
expect(User.unscoped{ User.find(user.id) }).to eq user
|
90
|
+
end
|
85
91
|
end
|
86
92
|
|
87
93
|
describe '#trashed?' do
|
data/storage_unit.gemspec
CHANGED
@@ -22,6 +22,7 @@ Gem::Specification.new do |s|
|
|
22
22
|
s.add_dependency 'rails', '~> 4.1', '>= 4.1.0'
|
23
23
|
|
24
24
|
s.add_development_dependency 'coveralls'
|
25
|
+
s.add_development_dependency 'guard-rspec'
|
25
26
|
s.add_development_dependency 'rspec-rails'
|
26
27
|
s.add_development_dependency 'sqlite3'
|
27
28
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: storage_unit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Becker
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-03-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -44,6 +44,20 @@ dependencies:
|
|
44
44
|
- - ">="
|
45
45
|
- !ruby/object:Gem::Version
|
46
46
|
version: '0'
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: guard-rspec
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - ">="
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - ">="
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '0'
|
47
61
|
- !ruby/object:Gem::Dependency
|
48
62
|
name: rspec-rails
|
49
63
|
requirement: !ruby/object:Gem::Requirement
|
@@ -83,6 +97,7 @@ files:
|
|
83
97
|
- ".ruby-version"
|
84
98
|
- ".travis.yml"
|
85
99
|
- Gemfile
|
100
|
+
- Guardfile
|
86
101
|
- LICENSE.md
|
87
102
|
- README.md
|
88
103
|
- lib/storage_unit.rb
|
@@ -113,7 +128,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
113
128
|
version: '0'
|
114
129
|
requirements: []
|
115
130
|
rubyforge_project:
|
116
|
-
rubygems_version: 2.
|
131
|
+
rubygems_version: 2.5.1
|
117
132
|
signing_key:
|
118
133
|
specification_version: 4
|
119
134
|
summary: Soft deletion for Rails 4, done right.
|
@@ -121,3 +136,4 @@ test_files:
|
|
121
136
|
- spec/setup.rb
|
122
137
|
- spec/spec_helper.rb
|
123
138
|
- spec/storage_unit_spec.rb
|
139
|
+
has_rdoc:
|