zombie_record 1.3.2 → 1.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: fc0664bd522be20b83206f39dd14cd2fefdacab5
4
- data.tar.gz: b531eae4d2138ab4739e6dd877bcd2630cf77a75
3
+ metadata.gz: c1960fadad22365102abfdc9b5f4e759d9190072
4
+ data.tar.gz: 6d2cef516af15fe77ca4e14f909583bb384ce788
5
5
  SHA512:
6
- metadata.gz: dada1eca031087897862d7f1709acfe27a2f926696727751062c6971a87bac4476724c98637e228fa14eb75014548521e9a5f4f053ea04870e6a958b977ddb55
7
- data.tar.gz: 1f26fe736a5919e15513ee249a7a87fae6df1647ce2d4319b4ba154470cfdd7e9c191dc7bc808878e971dd95d9566a73bf942799b85bebd8dc83546834b9b7b4
6
+ metadata.gz: 7d2d001bde1137fa0cf7e817419de2cb327015ccea5b4eb0e2178a6893834b026ca925f251874b2fc8e216a69deb7073f92894a347477d6bd5f38c13976133bf
7
+ data.tar.gz: c2f8e9ac8619adbf9888674d5fe7652cf3f9135b8457ee38f308047d63f3e793088a24288783c75ff5c0979b1e177102ca2a642564843ee38b4194f563d6849f
data/.gitignore CHANGED
@@ -3,7 +3,7 @@
3
3
  .bundle
4
4
  .config
5
5
  .yardoc
6
- Gemfile.lock
6
+ *[Gg]emfile.lock
7
7
  InstalledFiles
8
8
  _yardoc
9
9
  coverage
data/.travis.yml CHANGED
@@ -2,14 +2,20 @@ language: ruby
2
2
  rvm:
3
3
  - 2.1.8
4
4
  - 2.2.4
5
- - 2.3.0
5
+ - 2.3.3
6
+ - 2.4.1
6
7
  gemfile:
7
8
  - gemfiles/rails4.1.gemfile
8
9
  - gemfiles/rails4.2.gemfile
9
10
  - gemfiles/rails5.0.gemfile
11
+ - gemfiles/rails5.1.gemfile
10
12
  bundler_args: ""
11
13
  script: "bundle exec rake spec"
12
14
  matrix:
13
15
  exclude:
14
16
  - rvm: 2.1.8
15
17
  gemfile: gemfiles/rails5.0.gemfile
18
+ - rvm: 2.1.8
19
+ gemfile: gemfiles/rails5.1.gemfile
20
+ - rvm: 2.4.1
21
+ gemfile: gemfiles/rails4.1.gemfile
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  ###### Unreleased
2
2
 
3
+ ###### v1.3.2
4
+
5
+ * Implement `respond_to_missing?` when implementing `method_missing` or it
6
+ won't work on Ruby 2.3.0.
7
+
3
8
  ###### v1.3.1
4
9
 
5
10
  * Fix a `to_a` vs `records` bug for Rails 5.0.
@@ -2,4 +2,4 @@ source 'https://rubygems.org'
2
2
 
3
3
  gemspec path: "../"
4
4
 
5
- gem "activerecord", "~> 5.0.0.beta3"
5
+ gem "activerecord", "~> 5.0.0"
@@ -0,0 +1,5 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec path: "../"
4
+
5
+ gem "activerecord", "~> 5.1.0"
@@ -1,3 +1,3 @@
1
1
  module ZombieRecord
2
- VERSION = "1.3.2"
2
+ VERSION = "1.4.0"
3
3
  end
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe ZombieRecord::Restorable do
3
+ RSpec.describe ZombieRecord::Restorable do
4
4
  context "when the record is deleted" do
5
5
  it "allows accessing a deleted has_one association" do
6
6
  book = Book.create!
@@ -9,7 +9,7 @@ describe ZombieRecord::Restorable do
9
9
  book.destroy
10
10
  book = Book.with_deleted.first
11
11
 
12
- book.cover.should_not be_nil
12
+ expect(book.cover).not_to be_nil
13
13
  end
14
14
 
15
15
  it "allows accessing deleted belongs_to associations" do
@@ -19,7 +19,7 @@ describe ZombieRecord::Restorable do
19
19
  book.destroy
20
20
  chapter = Chapter.with_deleted.first
21
21
 
22
- chapter.book.should == book
22
+ expect(chapter.book).to eq(book)
23
23
  end
24
24
 
25
25
  it "allows accessing deleted polymorphic belongs_to associations" do
@@ -29,7 +29,7 @@ describe ZombieRecord::Restorable do
29
29
  tag.destroy
30
30
  tag = Tag.with_deleted.first
31
31
 
32
- tag.taggable.should == book
32
+ expect(tag.taggable).to eq(book)
33
33
  end
34
34
 
35
35
  it "ensures deleted associations themselves allow access to deleted records" do
@@ -40,10 +40,10 @@ describe ZombieRecord::Restorable do
40
40
  book.destroy
41
41
  bookmark = Bookmark.with_deleted.first
42
42
 
43
- bookmark.book.chapters.should == [chapter]
43
+ expect(bookmark.book.chapters).to eq([chapter])
44
44
  chapter = bookmark.book.chapters.first
45
45
 
46
- chapter.book.should == book
46
+ expect(chapter.book).to eq(book)
47
47
  end
48
48
 
49
49
  it "forwards normal method calls" do
@@ -51,7 +51,7 @@ describe ZombieRecord::Restorable do
51
51
  book.destroy
52
52
  book = Book.with_deleted.first
53
53
 
54
- book.title.should == "The Odyssey"
54
+ expect(book.title).to eq("The Odyssey")
55
55
  end
56
56
  end
57
57
 
@@ -62,7 +62,7 @@ describe ZombieRecord::Restorable do
62
62
 
63
63
  book1.destroy
64
64
 
65
- Book.deleted.should == [book1]
65
+ expect(Book.deleted).to eq([book1])
66
66
  end
67
67
 
68
68
  it "respects associations" do
@@ -73,7 +73,7 @@ describe ZombieRecord::Restorable do
73
73
  book.destroy
74
74
  other_book.destroy
75
75
 
76
- author.books.deleted.should == [book]
76
+ expect(author.books.deleted).to eq([book])
77
77
  end
78
78
  end
79
79
 
@@ -84,7 +84,7 @@ describe ZombieRecord::Restorable do
84
84
 
85
85
  book.destroy
86
86
 
87
- book.updated_at.should_not == updated_at
87
+ expect(book.updated_at).not_to eq(updated_at)
88
88
  end
89
89
 
90
90
  it "does not set #updated_at if it is not defined" do
@@ -112,7 +112,7 @@ describe ZombieRecord::Restorable do
112
112
  book.destroy
113
113
 
114
114
  deleted_book.restore!
115
- deleted_book.deleted_at.should be_nil
115
+ expect(deleted_book.deleted_at).to be_nil
116
116
  end
117
117
 
118
118
  it "also restores restorable has_many associated records" do
@@ -122,7 +122,7 @@ describe ZombieRecord::Restorable do
122
122
  deleted_book.restore!
123
123
 
124
124
  deleted_chapter = Chapter.with_deleted.find(chapter.id)
125
- deleted_chapter.deleted_at.should be_nil
125
+ expect(deleted_chapter.deleted_at).to be_nil
126
126
  end
127
127
 
128
128
  it "also restores restorable has_one associated records" do
@@ -132,7 +132,7 @@ describe ZombieRecord::Restorable do
132
132
  deleted_book.restore!
133
133
 
134
134
  deleted_cover = Cover.with_deleted.find(cover.id)
135
- deleted_cover.deleted_at.should be_nil
135
+ expect(deleted_cover.deleted_at).to be_nil
136
136
  end
137
137
 
138
138
  it "also restores restorable belongs_to associated records" do
@@ -143,7 +143,7 @@ describe ZombieRecord::Restorable do
143
143
  deleted_book.restore!
144
144
 
145
145
  deleted_author = Author.with_deleted.find(author.id)
146
- deleted_author.deleted_at.should be_nil
146
+ expect(deleted_author.deleted_at).to be_nil
147
147
  end
148
148
 
149
149
  it "does not restore hard deleted associated records" do
@@ -152,7 +152,7 @@ describe ZombieRecord::Restorable do
152
152
  book.destroy
153
153
  deleted_book.restore!
154
154
 
155
- Note.where(id: note.id).should_not exist
155
+ expect(Note.where(id: note.id)).not_to exist
156
156
  end
157
157
 
158
158
  it "does not restore an association if it is not destroy dependent" do
@@ -164,7 +164,7 @@ describe ZombieRecord::Restorable do
164
164
  deleted_book.restore!
165
165
 
166
166
  library_after_deletion = Library.with_deleted.find(library.id)
167
- library_after_deletion.deleted_at.should_not be_nil
167
+ expect(library_after_deletion.deleted_at).not_to be_nil
168
168
  end
169
169
 
170
170
  it "fails if the object itself has been destroyed" do
@@ -180,11 +180,11 @@ describe ZombieRecord::Restorable do
180
180
  it "returns true if the record is deleted" do
181
181
  book.destroy
182
182
 
183
- book.should be_deleted
183
+ expect(book).to be_deleted
184
184
  end
185
185
 
186
186
  it "returns false if the record is not deleted" do
187
- book.should_not be_deleted
187
+ expect(book).not_to be_deleted
188
188
  end
189
189
  end
190
190
  end
data/spec/spec_helper.rb CHANGED
@@ -60,6 +60,8 @@ class Library < ActiveRecord::Base
60
60
  end
61
61
 
62
62
  RSpec.configure do |config|
63
+ config.disable_monkey_patching!
64
+
63
65
  config.around do |example|
64
66
  ActiveRecord::Base.transaction do
65
67
  example.run
@@ -68,12 +70,14 @@ RSpec.configure do |config|
68
70
  end
69
71
 
70
72
  config.before :suite do
73
+ mysql = URI(ENV['MYSQL_URL'] || 'mysql://root@127.0.0.1:3306')
74
+
71
75
  ActiveRecord::Base.establish_connection(
72
76
  adapter: "mysql2",
73
- username: "root",
74
- host: "127.0.0.1",
75
- port: 3306,
76
- password: ""
77
+ username: mysql.user,
78
+ host: mysql.host,
79
+ port: mysql.port,
80
+ password: mysql.password
77
81
  )
78
82
 
79
83
  ActiveRecord::Base.connection.create_database("zombie_record")
@@ -15,14 +15,14 @@ Gem::Specification.new do |spec|
15
15
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
16
16
  spec.require_paths = ["lib"]
17
17
 
18
- spec.add_dependency "activerecord", ">= 4.0", "< 5.1"
18
+ spec.add_dependency "activerecord", ">= 4.1", "< 5.2"
19
19
  spec.add_dependency "mysql2"
20
20
 
21
21
  spec.add_development_dependency "bundler", "~> 1.3"
22
22
  spec.add_development_dependency "byebug"
23
23
  spec.add_development_dependency "rake"
24
24
  spec.add_development_dependency "bump"
25
- spec.add_development_dependency "rspec", "~> 2.14.1"
26
- spec.add_development_dependency "timecop", "~> 0.7.0"
27
- spec.add_development_dependency "wwtd", ">= 0.5.3"
25
+ spec.add_development_dependency "rspec", "~> 3.5.0"
26
+ spec.add_development_dependency "timecop"
27
+ spec.add_development_dependency "wwtd"
28
28
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zombie_record
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.2
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Schierbeck
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-04-08 00:00:00.000000000 Z
11
+ date: 2017-04-28 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: '4.0'
19
+ version: '4.1'
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
- version: '5.1'
22
+ version: '5.2'
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: '4.0'
29
+ version: '4.1'
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
- version: '5.1'
32
+ version: '5.2'
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: mysql2
35
35
  requirement: !ruby/object:Gem::Requirement
@@ -106,42 +106,42 @@ dependencies:
106
106
  requirements:
107
107
  - - "~>"
108
108
  - !ruby/object:Gem::Version
109
- version: 2.14.1
109
+ version: 3.5.0
110
110
  type: :development
111
111
  prerelease: false
112
112
  version_requirements: !ruby/object:Gem::Requirement
113
113
  requirements:
114
114
  - - "~>"
115
115
  - !ruby/object:Gem::Version
116
- version: 2.14.1
116
+ version: 3.5.0
117
117
  - !ruby/object:Gem::Dependency
118
118
  name: timecop
119
119
  requirement: !ruby/object:Gem::Requirement
120
120
  requirements:
121
- - - "~>"
121
+ - - ">="
122
122
  - !ruby/object:Gem::Version
123
- version: 0.7.0
123
+ version: '0'
124
124
  type: :development
125
125
  prerelease: false
126
126
  version_requirements: !ruby/object:Gem::Requirement
127
127
  requirements:
128
- - - "~>"
128
+ - - ">="
129
129
  - !ruby/object:Gem::Version
130
- version: 0.7.0
130
+ version: '0'
131
131
  - !ruby/object:Gem::Dependency
132
132
  name: wwtd
133
133
  requirement: !ruby/object:Gem::Requirement
134
134
  requirements:
135
135
  - - ">="
136
136
  - !ruby/object:Gem::Version
137
- version: 0.5.3
137
+ version: '0'
138
138
  type: :development
139
139
  prerelease: false
140
140
  version_requirements: !ruby/object:Gem::Requirement
141
141
  requirements:
142
142
  - - ">="
143
143
  - !ruby/object:Gem::Version
144
- version: 0.5.3
144
+ version: '0'
145
145
  description: Allows restoring your Active Records from the dead!
146
146
  email:
147
147
  - dasch@zendesk.com
@@ -158,11 +158,9 @@ files:
158
158
  - README.md
159
159
  - Rakefile
160
160
  - gemfiles/rails4.1.gemfile
161
- - gemfiles/rails4.1.gemfile.lock
162
161
  - gemfiles/rails4.2.gemfile
163
- - gemfiles/rails4.2.gemfile.lock
164
162
  - gemfiles/rails5.0.gemfile
165
- - gemfiles/rails5.0.gemfile.lock
163
+ - gemfiles/rails5.1.gemfile
166
164
  - lib/zombie_record.rb
167
165
  - lib/zombie_record/restorable.rb
168
166
  - lib/zombie_record/version.rb
@@ -189,7 +187,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
189
187
  version: '0'
190
188
  requirements: []
191
189
  rubyforge_project:
192
- rubygems_version: 2.6.2
190
+ rubygems_version: 2.6.11
193
191
  signing_key:
194
192
  specification_version: 4
195
193
  summary: Allows restoring your Active Records from the dead!
@@ -1,64 +0,0 @@
1
- PATH
2
- remote: ../
3
- specs:
4
- zombie_record (1.3.2)
5
- activerecord (>= 4.0, < 5.1)
6
- mysql2
7
-
8
- GEM
9
- remote: https://rubygems.org/
10
- specs:
11
- activemodel (4.1.14)
12
- activesupport (= 4.1.14)
13
- builder (~> 3.1)
14
- activerecord (4.1.14)
15
- activemodel (= 4.1.14)
16
- activesupport (= 4.1.14)
17
- arel (~> 5.0.0)
18
- activesupport (4.1.14)
19
- i18n (~> 0.6, >= 0.6.9)
20
- json (~> 1.7, >= 1.7.7)
21
- minitest (~> 5.1)
22
- thread_safe (~> 0.1)
23
- tzinfo (~> 1.1)
24
- arel (5.0.1.20140414130214)
25
- builder (3.2.2)
26
- bump (0.5.3)
27
- byebug (8.2.1)
28
- diff-lcs (1.2.5)
29
- i18n (0.7.0)
30
- json (1.8.3)
31
- minitest (5.8.3)
32
- mysql2 (0.3.20)
33
- rake (10.4.2)
34
- rspec (2.14.1)
35
- rspec-core (~> 2.14.0)
36
- rspec-expectations (~> 2.14.0)
37
- rspec-mocks (~> 2.14.0)
38
- rspec-core (2.14.8)
39
- rspec-expectations (2.14.5)
40
- diff-lcs (>= 1.1.3, < 2.0)
41
- rspec-mocks (2.14.6)
42
- thread_safe (0.3.5)
43
- timecop (0.7.4)
44
- tzinfo (1.2.2)
45
- thread_safe (~> 0.1)
46
- wwtd (1.3.0)
47
-
48
- PLATFORMS
49
- ruby
50
-
51
- DEPENDENCIES
52
- activerecord (~> 4.1.8)
53
- bump
54
- bundler (~> 1.3)
55
- byebug
56
- mysql2 (~> 0.3.0)
57
- rake
58
- rspec (~> 2.14.1)
59
- timecop (~> 0.7.0)
60
- wwtd (>= 0.5.3)
61
- zombie_record!
62
-
63
- BUNDLED WITH
64
- 1.11.2
@@ -1,63 +0,0 @@
1
- PATH
2
- remote: ../
3
- specs:
4
- zombie_record (1.3.2)
5
- activerecord (>= 4.0, < 5.1)
6
- mysql2
7
-
8
- GEM
9
- remote: https://rubygems.org/
10
- specs:
11
- activemodel (4.2.5)
12
- activesupport (= 4.2.5)
13
- builder (~> 3.1)
14
- activerecord (4.2.5)
15
- activemodel (= 4.2.5)
16
- activesupport (= 4.2.5)
17
- arel (~> 6.0)
18
- activesupport (4.2.5)
19
- i18n (~> 0.7)
20
- json (~> 1.7, >= 1.7.7)
21
- minitest (~> 5.1)
22
- thread_safe (~> 0.3, >= 0.3.4)
23
- tzinfo (~> 1.1)
24
- arel (6.0.3)
25
- builder (3.2.2)
26
- bump (0.5.3)
27
- byebug (8.2.1)
28
- diff-lcs (1.2.5)
29
- i18n (0.7.0)
30
- json (1.8.3)
31
- minitest (5.8.3)
32
- mysql2 (0.4.2)
33
- rake (10.4.2)
34
- rspec (2.14.1)
35
- rspec-core (~> 2.14.0)
36
- rspec-expectations (~> 2.14.0)
37
- rspec-mocks (~> 2.14.0)
38
- rspec-core (2.14.8)
39
- rspec-expectations (2.14.5)
40
- diff-lcs (>= 1.1.3, < 2.0)
41
- rspec-mocks (2.14.6)
42
- thread_safe (0.3.5)
43
- timecop (0.7.4)
44
- tzinfo (1.2.2)
45
- thread_safe (~> 0.1)
46
- wwtd (1.3.0)
47
-
48
- PLATFORMS
49
- ruby
50
-
51
- DEPENDENCIES
52
- activerecord (~> 4.2.0)
53
- bump
54
- bundler (~> 1.3)
55
- byebug
56
- rake
57
- rspec (~> 2.14.1)
58
- timecop (~> 0.7.0)
59
- wwtd (>= 0.5.3)
60
- zombie_record!
61
-
62
- BUNDLED WITH
63
- 1.11.2
@@ -1,60 +0,0 @@
1
- PATH
2
- remote: ../
3
- specs:
4
- zombie_record (1.3.2)
5
- activerecord (>= 4.0, < 5.1)
6
- mysql2
7
-
8
- GEM
9
- remote: https://rubygems.org/
10
- specs:
11
- activemodel (5.0.0.beta3)
12
- activesupport (= 5.0.0.beta3)
13
- activerecord (5.0.0.beta3)
14
- activemodel (= 5.0.0.beta3)
15
- activesupport (= 5.0.0.beta3)
16
- arel (~> 7.0)
17
- activesupport (5.0.0.beta3)
18
- concurrent-ruby (~> 1.0)
19
- i18n (~> 0.7)
20
- minitest (~> 5.1)
21
- tzinfo (~> 1.1)
22
- arel (7.0.0)
23
- bump (0.5.3)
24
- byebug (8.2.1)
25
- concurrent-ruby (1.0.1)
26
- diff-lcs (1.2.5)
27
- i18n (0.7.0)
28
- minitest (5.8.4)
29
- mysql2 (0.4.2)
30
- rake (10.4.2)
31
- rspec (2.14.1)
32
- rspec-core (~> 2.14.0)
33
- rspec-expectations (~> 2.14.0)
34
- rspec-mocks (~> 2.14.0)
35
- rspec-core (2.14.8)
36
- rspec-expectations (2.14.5)
37
- diff-lcs (>= 1.1.3, < 2.0)
38
- rspec-mocks (2.14.6)
39
- thread_safe (0.3.5)
40
- timecop (0.7.4)
41
- tzinfo (1.2.2)
42
- thread_safe (~> 0.1)
43
- wwtd (1.3.0)
44
-
45
- PLATFORMS
46
- ruby
47
-
48
- DEPENDENCIES
49
- activerecord (~> 5.0.0.beta3)
50
- bump
51
- bundler (~> 1.3)
52
- byebug
53
- rake
54
- rspec (~> 2.14.1)
55
- timecop (~> 0.7.0)
56
- wwtd (>= 0.5.3)
57
- zombie_record!
58
-
59
- BUNDLED WITH
60
- 1.11.2