destroyed_at 0.3.1 → 0.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
2
  SHA1:
3
- metadata.gz: dcb907905ded6d91d8608d0946fd0e47dc6e40a5
4
- data.tar.gz: 2ee4044301299b5e5b503b1419b28646713a7f37
3
+ metadata.gz: d63b138a42814623971150b35a82be8241fa698c
4
+ data.tar.gz: 7fc26af45fd4890ba6e705e0cada5c739c962cb9
5
5
  SHA512:
6
- metadata.gz: 7febe07d4630e309263f8cb3575d898e9c4d22239a36d6befe37d02065d8bf8f7fd32b748fe1f536dd65c8f5fdc3821efb22836113a0f33ca5571604f6688f44
7
- data.tar.gz: 4ff52345686b2a891b04556d22f8b77ff1a0e556f098c22b48de85cd00260b25e7dfd9d2f339a5ed20a82848dbb86ef3bb82fcd5500b97e279bededd3ee59aed
6
+ metadata.gz: 1cb8db486711ff5a47de49a2b5d47ad0cc45c2e437c341279590c6619acfefba7cdd6836e1a79193a43da033a138d54fe46fd0b0b9ecb84459a9a9da23630ea1
7
+ data.tar.gz: 885386854dcc5e2ecdb7e51d85f254a630bc68e8c1e4594d2f6f40179721f6a3609f59419401e062dab39682b22036349c9104539b9017eedd0f756ce1f0e862
data/.gitignore CHANGED
@@ -17,3 +17,4 @@ test/tmp
17
17
  test/version_tmp
18
18
  tmp
19
19
  bin/
20
+ .DS_Store
data/.travis.yml CHANGED
@@ -1,5 +1,9 @@
1
1
  rvm:
2
2
  - 2.0.0
3
+ - 2.1.0
4
+
5
+ before_install:
6
+ - gem install bundler -v '= 1.5.1'
3
7
 
4
8
  notifications:
5
9
  hipchat:
data/CHANGELOG.md CHANGED
@@ -1,4 +1,15 @@
1
+ ## 0.4.0
2
+
3
+ * Updates for Rails 4.1
4
+ * Removes `.with_default_scope` which has been deprecated.
5
+ * Enables retrieval of destroyed objects by time via `.destroyed`
6
+ method, which now takes an optional time attribute. - Lin Reid & Dan
7
+ McClain
8
+ * Removes `m` as a development dependency, since it is not compatible
9
+ with `minitest 5`.
10
+
1
11
  ## 0.3.1
12
+ **Stable for Rails 4.0**
2
13
 
3
14
  * [Bug] Fixed route not raising when resource constant does not exist -
4
15
  Brian Cardarella
data/README.md CHANGED
@@ -169,7 +169,7 @@ on how to properly submit issues and pull requests.
169
169
 
170
170
  ## Legal ##
171
171
 
172
- [DockYard](http://dockyard.com), LLC © 2013
172
+ [DockYard](http://dockyard.com) Inc. © 2014
173
173
 
174
174
  [@dockyard](http://twitter.com/dockyard)
175
175
 
data/destroyed_at.gemspec CHANGED
@@ -17,15 +17,14 @@ Gem::Specification.new do |spec|
17
17
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
18
  spec.require_paths = ["lib"]
19
19
 
20
- spec.required_ruby_version = '>= 2.0'
20
+ spec.required_ruby_version = '>= 2.1'
21
21
 
22
- spec.add_runtime_dependency "activerecord", "~> 4.0.0"
23
- spec.add_runtime_dependency 'actionpack', '~> 4.0.0'
22
+ spec.add_runtime_dependency "activerecord", '~> 4.1'
23
+ spec.add_runtime_dependency 'actionpack', '~> 4.1'
24
24
 
25
25
  spec.add_development_dependency "bundler", "~> 1.3"
26
26
  spec.add_development_dependency "rake"
27
- spec.add_development_dependency "minitest"
28
- spec.add_development_dependency "m"
27
+ spec.add_development_dependency "minitest", "~> 5.1"
29
28
  spec.add_development_dependency "sqlite3"
30
29
  spec.add_development_dependency "byebug"
31
30
  spec.add_development_dependency "timecop"
data/lib/destroyed_at.rb CHANGED
@@ -15,12 +15,12 @@ module DestroyedAt
15
15
  end
16
16
 
17
17
  module ClassMethods
18
- def destroyed
19
- query = all.with_default_scope
18
+ def destroyed(time = nil)
19
+ query = where.not(destroyed_at: nil)
20
20
  query.where_values.reject! do |node|
21
21
  Arel::Nodes::Equality === node && node.left.name == 'destroyed_at' && node.right.nil?
22
22
  end
23
- query.where.not(destroyed_at: nil)
23
+ time ? query.where(destroyed_at: time) : query.where.not(destroyed_at: nil)
24
24
  end
25
25
  end
26
26
 
@@ -1,3 +1,3 @@
1
1
  module DestroyedAt
2
- VERSION = "0.3.1"
2
+ VERSION = "0.4.0"
3
3
  end
data/test/scope_test.rb CHANGED
@@ -48,5 +48,24 @@ describe 'Scopes' do
48
48
  destroyed_comments.wont_include comment_3
49
49
  end
50
50
  end
51
+
52
+ context 'Called on a child relation and passing in a destroyed_at time' do
53
+ let(:destroyed_comments) { post.comments.destroyed(post.destroyed_at) }
54
+
55
+ before do
56
+ post.destroy
57
+ comment_2.update(destroyed_at: post.destroyed_at - 1.hour)
58
+ end
59
+
60
+ it 'returns all child records with a destroyed_at time that matches the passed in time' do
61
+ destroyed_comments.must_include comment_1
62
+ end
63
+
64
+ it 'does not return child records with a destroyed_at time that does not match the passed in time' do
65
+ destroyed_comments.wont_include comment_2
66
+ destroyed_comments.wont_include comment_3
67
+ destroyed_comments.wont_include comment_4
68
+ end
69
+ end
51
70
  end
52
71
  end
metadata CHANGED
@@ -1,139 +1,125 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: destroyed_at
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Dupuis Jr.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-11-23 00:00:00.000000000 Z
11
+ date: 2014-04-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 4.0.0
19
+ version: '4.1'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 4.0.0
26
+ version: '4.1'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: actionpack
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 4.0.0
33
+ version: '4.1'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ~>
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 4.0.0
40
+ version: '4.1'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: bundler
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ~>
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
47
  version: '1.3'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ~>
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '1.3'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rake
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - '>='
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - '>='
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: minitest
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - '>='
73
+ - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '0'
75
+ version: '5.1'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - '>='
80
+ - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '0'
83
- - !ruby/object:Gem::Dependency
84
- name: m
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - '>='
88
- - !ruby/object:Gem::Version
89
- version: '0'
90
- type: :development
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - '>='
95
- - !ruby/object:Gem::Version
96
- version: '0'
82
+ version: '5.1'
97
83
  - !ruby/object:Gem::Dependency
98
84
  name: sqlite3
99
85
  requirement: !ruby/object:Gem::Requirement
100
86
  requirements:
101
- - - '>='
87
+ - - ">="
102
88
  - !ruby/object:Gem::Version
103
89
  version: '0'
104
90
  type: :development
105
91
  prerelease: false
106
92
  version_requirements: !ruby/object:Gem::Requirement
107
93
  requirements:
108
- - - '>='
94
+ - - ">="
109
95
  - !ruby/object:Gem::Version
110
96
  version: '0'
111
97
  - !ruby/object:Gem::Dependency
112
98
  name: byebug
113
99
  requirement: !ruby/object:Gem::Requirement
114
100
  requirements:
115
- - - '>='
101
+ - - ">="
116
102
  - !ruby/object:Gem::Version
117
103
  version: '0'
118
104
  type: :development
119
105
  prerelease: false
120
106
  version_requirements: !ruby/object:Gem::Requirement
121
107
  requirements:
122
- - - '>='
108
+ - - ">="
123
109
  - !ruby/object:Gem::Version
124
110
  version: '0'
125
111
  - !ruby/object:Gem::Dependency
126
112
  name: timecop
127
113
  requirement: !ruby/object:Gem::Requirement
128
114
  requirements:
129
- - - '>='
115
+ - - ">="
130
116
  - !ruby/object:Gem::Version
131
117
  version: '0'
132
118
  type: :development
133
119
  prerelease: false
134
120
  version_requirements: !ruby/object:Gem::Requirement
135
121
  requirements:
136
- - - '>='
122
+ - - ">="
137
123
  - !ruby/object:Gem::Version
138
124
  version: '0'
139
125
  - !ruby/object:Gem::Dependency
@@ -157,15 +143,14 @@ executables: []
157
143
  extensions: []
158
144
  extra_rdoc_files: []
159
145
  files:
160
- - .gitignore
161
- - .travis.yml
146
+ - ".gitignore"
147
+ - ".travis.yml"
162
148
  - CHANGELOG.md
163
149
  - CONTRIBUTING.md
164
150
  - Gemfile
165
151
  - README.md
166
152
  - Rakefile
167
153
  - destroyed_at.gemspec
168
- - lib/.DS_Store
169
154
  - lib/destroyed_at.rb
170
155
  - lib/destroyed_at/belongs_to_association.rb
171
156
  - lib/destroyed_at/has_many_association.rb
@@ -187,17 +172,17 @@ require_paths:
187
172
  - lib
188
173
  required_ruby_version: !ruby/object:Gem::Requirement
189
174
  requirements:
190
- - - '>='
175
+ - - ">="
191
176
  - !ruby/object:Gem::Version
192
- version: '2.0'
177
+ version: '2.1'
193
178
  required_rubygems_version: !ruby/object:Gem::Requirement
194
179
  requirements:
195
- - - '>='
180
+ - - ">="
196
181
  - !ruby/object:Gem::Version
197
182
  version: '0'
198
183
  requirements: []
199
184
  rubyforge_project:
200
- rubygems_version: 2.0.3
185
+ rubygems_version: 2.2.0
201
186
  signing_key:
202
187
  specification_version: 4
203
188
  summary: Safe destroy for ActiveRecord.
data/lib/.DS_Store DELETED
Binary file