acts_as_archival 1.1.1 → 2.0.0

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.
Files changed (64) hide show
  1. checksums.yaml +5 -5
  2. data/.gitignore +1 -1
  3. data/.rubocop.yml +71 -0
  4. data/.rubocop_todo.yml +98 -0
  5. data/.travis.yml +23 -0
  6. data/Appraisals +7 -7
  7. data/CHANGELOG.md +29 -0
  8. data/Gemfile.lock +70 -0
  9. data/README.md +49 -19
  10. data/Rakefile +6 -3
  11. data/acts_as_archival.gemspec +23 -17
  12. data/gemfiles/rails_5.2.gemfile +8 -0
  13. data/gemfiles/{rails_4.2.gemfile → rails_6.0.gemfile} +2 -2
  14. data/gemfiles/{rails_5.0.gemfile → rails_6.1.gemfile} +2 -2
  15. data/lib/acts_as_archival/version.rb +3 -1
  16. data/lib/acts_as_archival.rb +2 -0
  17. data/lib/expected_behavior/acts_as_archival.rb +111 -77
  18. data/lib/expected_behavior/acts_as_archival_active_record_methods.rb +29 -4
  19. data/lib/expected_behavior/association_operation/archive.rb +1 -1
  20. data/lib/expected_behavior/association_operation/base.rb +12 -9
  21. data/lib/expected_behavior/association_operation/unarchive.rb +2 -2
  22. data/script/setup +0 -3
  23. data/test/ambiguous_table_test.rb +3 -1
  24. data/test/application_record_test.rb +5 -3
  25. data/test/associations_test.rb +19 -17
  26. data/test/basic_test.rb +16 -14
  27. data/test/callbacks_test.rb +8 -6
  28. data/test/column_test.rb +8 -6
  29. data/test/deep_nesting_test.rb +6 -4
  30. data/test/fixtures/another_polys_holder.rb +11 -0
  31. data/test/fixtures/application_record.rb +2 -0
  32. data/test/fixtures/application_record_row.rb +2 -0
  33. data/test/fixtures/archival.rb +9 -7
  34. data/test/fixtures/archival_grandkid.rb +2 -0
  35. data/test/fixtures/archival_kid.rb +3 -1
  36. data/test/fixtures/archival_table_name.rb +2 -0
  37. data/test/fixtures/callback_archival_4.rb +2 -0
  38. data/test/fixtures/callback_archival_5.rb +4 -1
  39. data/test/fixtures/exploder.rb +2 -0
  40. data/test/fixtures/independent_archival.rb +2 -0
  41. data/test/fixtures/missing_archive_number.rb +2 -0
  42. data/test/fixtures/missing_archived_at.rb +2 -0
  43. data/test/fixtures/plain.rb +2 -0
  44. data/test/fixtures/poly.rb +3 -1
  45. data/test/fixtures/readonly_when_archived.rb +3 -1
  46. data/test/polymorphic_test.rb +29 -4
  47. data/test/readonly_when_archived_test.rb +6 -4
  48. data/test/relations_test.rb +63 -0
  49. data/test/responds_test.rb +8 -6
  50. data/test/schema.rb +64 -77
  51. data/test/scope_test.rb +28 -23
  52. data/test/test_helper.rb +47 -40
  53. data/test/through_association_test.rb +4 -2
  54. data/test/transaction_test.rb +7 -58
  55. metadata +33 -50
  56. data/gemfiles/rails_4.1.gemfile +0 -8
  57. data/script/db_setup +0 -51
  58. data/test/database.yml +0 -26
  59. data/test/fixtures/mass_attribute_protected.rb +0 -7
  60. data/test/fixtures/mysql_archival.rb +0 -10
  61. data/test/fixtures/mysql_exploder.rb +0 -9
  62. data/test/fixtures/pg_archival.rb +0 -10
  63. data/test/fixtures/pg_exploder.rb +0 -9
  64. data/test/mass_attribute_test.rb +0 -20
data/test/scope_test.rb CHANGED
@@ -1,6 +1,8 @@
1
+ # coding: utf-8
1
2
  require_relative "test_helper"
2
3
 
3
4
  class ScopeTest < ActiveSupport::TestCase
5
+
4
6
  test "simple unarchived scope" do
5
7
  Archival.create!
6
8
  Archival.create!
@@ -9,15 +11,15 @@ class ScopeTest < ActiveSupport::TestCase
9
11
  end
10
12
 
11
13
  test "simple archived scope" do
12
- Archival.create!.archive
13
- Archival.create!.archive
14
+ Archival.create!.archive!
15
+ Archival.create!.archive!
14
16
 
15
17
  assert_equal 2, Archival.archived.count
16
18
  end
17
19
 
18
20
  test "mixed scopes" do
19
21
  Archival.create!
20
- Archival.create!.archive
22
+ Archival.create!.archive!
21
23
 
22
24
  assert_equal 1, Archival.archived.count
23
25
  assert_equal 1, Archival.unarchived.count
@@ -25,8 +27,8 @@ class ScopeTest < ActiveSupport::TestCase
25
27
 
26
28
  test "simple archived_from_archive_number" do
27
29
  archive_number = "TEST-IT"
28
- Archival.create!.archive(archive_number)
29
- Archival.create!.archive(archive_number)
30
+ Archival.create!.archive!(archive_number)
31
+ Archival.create!.archive!(archive_number)
30
32
 
31
33
  assert_equal 2, Archival.archived_from_archive_number(archive_number).count
32
34
  end
@@ -34,39 +36,41 @@ class ScopeTest < ActiveSupport::TestCase
34
36
  test "negative archived_from_archive_number" do
35
37
  archive_number = "TEST-IT"
36
38
  bogus_number = "BROKE-IT"
37
- Archival.create!.archive(archive_number)
38
- Archival.create!.archive(archive_number)
39
+ Archival.create!.archive!(archive_number)
40
+ Archival.create!.archive!(archive_number)
39
41
 
40
42
  assert_equal 0, Archival.archived_from_archive_number(bogus_number).count
41
43
  end
42
44
 
43
45
  test "mixed archived_from_archive_number" do
44
46
  archive_number = "TEST-IT"
45
- Archival.create!.archive(archive_number)
46
- Archival.create!.archive
47
+ Archival.create!.archive!(archive_number)
48
+ Archival.create!.archive!
47
49
 
48
50
  assert_equal 1, Archival.archived_from_archive_number(archive_number).count
49
51
  end
50
52
 
51
53
  test "table_name is set to 'legacy'" do
52
- # ActiveRecord 4.2 changed the output by one space (╯°□°)╯︵ ┻━┻
53
- spaces = if (ActiveRecord.version <=> Gem::Version.new("4.2.0")) >= 0
54
- " "
55
- else
56
- " "
57
- end
58
- archived_sql = %Q{SELECT "legacy".* FROM "legacy"#{spaces}WHERE ("legacy"."archived_at" IS NOT NULL) AND ("legacy"."archive_number" IS NOT NULL)}
59
- unarchived_sql = %Q{SELECT "legacy".* FROM "legacy"#{spaces}WHERE "legacy"."archived_at" IS NULL AND "legacy"."archive_number" IS NULL}
54
+ archived_sql =
55
+ if ActiveRecord.version >= Gem::Version.new("5.2.0")
56
+ "SELECT \"legacy\".* FROM \"legacy\" " \
57
+ 'WHERE "legacy"."archived_at" IS NOT NULL AND "legacy"."archive_number" IS NOT NULL'
58
+ else
59
+ "SELECT \"legacy\".* FROM \"legacy\" " \
60
+ 'WHERE ("legacy"."archived_at" IS NOT NULL) AND ("legacy"."archive_number" IS NOT NULL)'
61
+ end
62
+ unarchived_sql = "SELECT \"legacy\".* FROM \"legacy\" " \
63
+ 'WHERE "legacy"."archived_at" IS NULL AND "legacy"."archive_number" IS NULL'
60
64
  assert_equal archived_sql, ArchivalTableName.archived.to_sql
61
65
  assert_equal unarchived_sql, ArchivalTableName.unarchived.to_sql
62
66
  end
63
67
 
64
68
  test "combines with other scope properly" do
65
- Archival.create!(:name => "Robert")
66
- Archival.create!(:name => "Bobby")
67
- Archival.create!(:name => "Sue")
68
- bob = Archival.create!(:name => "Bob")
69
- bob.archive
69
+ Archival.create!(name: "Robert")
70
+ Archival.create!(name: "Bobby")
71
+ Archival.create!(name: "Sue")
72
+ bob = Archival.create!(name: "Bob")
73
+ bob.archive!
70
74
  assert_equal 3, Archival.bobs.count
71
75
  assert_equal 3, Archival.unarchived.count
72
76
  assert_equal 2, Archival.bobs.unarchived.count
@@ -80,9 +84,10 @@ class ScopeTest < ActiveSupport::TestCase
80
84
  parent.archivals.create!
81
85
  parent.archivals.create!
82
86
  child = parent.archivals.create!
83
- child.archive
87
+ child.archive!
84
88
  assert_equal 3, parent.archivals.count
85
89
  assert_equal 1, parent.archivals.archived.count
86
90
  assert_equal 2, parent.archivals.unarchived.count
87
91
  end
92
+
88
93
  end
data/test/test_helper.rb CHANGED
@@ -1,6 +1,7 @@
1
- $:.unshift(File.dirname(__FILE__) + '/../lib')
1
+ $LOAD_PATH.unshift(File.dirname(__FILE__) + "/../lib")
2
2
  require "bundler/setup"
3
3
  require "minitest/autorun"
4
+ require "minitest/pride"
4
5
 
5
6
  require "active_record"
6
7
  require "assertions"
@@ -13,8 +14,7 @@ if ActiveSupport::TestCase.respond_to?(:test_order=)
13
14
  end
14
15
 
15
16
  def prepare_for_tests
16
- setup_logging# if ENV["LOGGING_ENABLED"]
17
- setup_active_record
17
+ setup_logging
18
18
  setup_database_cleaner
19
19
  create_test_tables
20
20
  require_test_classes
@@ -26,11 +26,6 @@ def setup_logging
26
26
  ActiveRecord::Base.logger = Logger.new(logfile)
27
27
  end
28
28
 
29
- def setup_active_record
30
- dbconfig_file = File.dirname(__FILE__) + "/database.yml"
31
- $dbconfig = YAML.load(File.read(dbconfig_file))
32
- end
33
-
34
29
  def setup_database_cleaner
35
30
  DatabaseCleaner.strategy = :truncation
36
31
  ActiveSupport::TestCase.send(:setup) do
@@ -38,48 +33,60 @@ def setup_database_cleaner
38
33
  end
39
34
  end
40
35
 
36
+ def sqlite_config
37
+ {
38
+ adapter: "sqlite3",
39
+ database: "aaa_test.sqlite3",
40
+ pool: 5,
41
+ timeout: 5000
42
+ }
43
+ end
44
+
41
45
  def create_test_tables
42
46
  schema_file = File.dirname(__FILE__) + "/schema.rb"
43
- ["pg", "mysql", "sqlite"].each do |db|
44
- puts "** Loading schema for #{db}"
45
- ActiveRecord::Base.establish_connection($dbconfig[db])
46
- load(schema_file) if File.exist?(schema_file)
47
- end
47
+ puts "** Loading schema for SQLite"
48
+ ActiveRecord::Base.establish_connection(sqlite_config)
49
+ load(schema_file) if File.exist?(schema_file)
48
50
  end
49
51
 
52
+ BASE_FIXTURE_CLASSES = [
53
+ :another_polys_holder,
54
+ :archival,
55
+ :archival_kid,
56
+ :archival_grandkid,
57
+ :archival_table_name,
58
+ :exploder,
59
+ :independent_archival,
60
+ :missing_archived_at,
61
+ :missing_archive_number,
62
+ :plain,
63
+ :poly,
64
+ :readonly_when_archived
65
+ ].freeze
66
+
67
+ RAILS_4_FIXTURE_CLASSES = [
68
+ :callback_archival_4
69
+ ].freeze
70
+
71
+ RAILS_5_FIXTURE_CLASSES = [
72
+ :application_record,
73
+ :application_record_row,
74
+ :callback_archival_5
75
+ ].freeze
76
+
50
77
  def require_test_classes
51
78
  ActiveSupport::Inflector.inflections do |inflect|
52
79
  inflect.irregular "poly", "polys"
53
80
  end
54
81
 
55
- fixtures = []
56
- $require_application_record = ActiveRecord.version >= Gem::Version.new("4.99.99")
57
- if $require_application_record
58
- fixtures += [:application_record, :application_record_row, :callback_archival_5]
59
- else
60
- fixtures += [:callback_archival_4]
61
- end
82
+ fixtures = if ActiveRecord::VERSION::MAJOR >= 4
83
+ RAILS_5_FIXTURE_CLASSES
84
+ else
85
+ RAILS_4_FIXTURE_CLASSES
86
+ end
62
87
 
63
- fixtures += [
64
- :archival,
65
- :archival_kid,
66
- :archival_grandkid,
67
- :archival_table_name,
68
- :exploder,
69
- :independent_archival,
70
- :missing_archived_at,
71
- :missing_archive_number,
72
- :mysql_archival,
73
- :mysql_exploder,
74
- :plain,
75
- :poly,
76
- :pg_archival,
77
- :pg_exploder,
78
- :readonly_when_archived
79
- ]
80
- $require_mass_protection = ActiveModel.constants.include?(:MassAssignmentSecurity)
81
- fixtures << :mass_attribute_protected if $require_mass_protection
82
- fixtures.each {|test_class_file| require_relative "fixtures/#{test_class_file}"}
88
+ fixtures += BASE_FIXTURE_CLASSES
89
+ fixtures.each { |test_class_file| require_relative "fixtures/#{test_class_file}" }
83
90
  end
84
91
 
85
92
  prepare_for_tests
@@ -1,18 +1,19 @@
1
1
  require_relative "test_helper"
2
2
 
3
3
  class ThroughAssociationTest < ActiveSupport::TestCase
4
+
4
5
  test "archive a through associated object whose 'bridge' is archival" do
5
6
  archival = Archival.create!
6
7
  bridge = archival.archival_kids.create!
7
8
  through = bridge.archival_grandkids.create!
8
- archival.archive
9
+ archival.archive!
9
10
 
10
11
  assert archival.reload.archived?
11
12
  assert bridge.reload.archived?
12
13
  assert through.reload.archived?
13
14
  end
14
15
 
15
- # TODO Make something like this pass
16
+ # TODO: Make something like this pass
16
17
  # test "archive a through associated object whose 'bridge' is not archival" do
17
18
  # archival = Archival.create!
18
19
  # bridge = archival.independent_archival_kids.create!
@@ -22,4 +23,5 @@ class ThroughAssociationTest < ActiveSupport::TestCase
22
23
  # assert archival.reload.archived?
23
24
  # assert through.reload.archived?
24
25
  # end
26
+
25
27
  end
@@ -3,80 +3,29 @@ require "rr"
3
3
 
4
4
  class TransactionTest < ActiveSupport::TestCase
5
5
 
6
- test "sqlite archiving is transactional" do
6
+ test "archiving is transactional" do
7
7
  archival = Archival.create!
8
8
  exploder = archival.exploders.create!
9
9
  any_instance_of(Exploder) do |canary|
10
- stub(canary).archive { raise "Rollback Imminent" }
10
+ stub(canary).archive! { raise "Rollback Imminent" }
11
11
  end
12
- archival.archive
12
+ archival.archive!
13
13
 
14
14
  assert_not archival.archived?, "If this failed, you might be trying to test on a system that doesn't support nested transactions"
15
15
  assert_not exploder.reload.archived?
16
16
  end
17
17
 
18
- test "sqlite unarchiving is transactional" do
18
+ test "unarchiving is transactional" do
19
19
  archival = Archival.create!
20
20
  exploder = archival.exploders.create!
21
21
  any_instance_of(Exploder) do |canary|
22
- stub(canary).unarchive { raise "Rollback Imminent" }
22
+ stub(canary).unarchive! { raise "Rollback Imminent" }
23
23
  end
24
- archival.archive
25
- archival.unarchive
24
+ archival.archive!
25
+ archival.unarchive!
26
26
 
27
27
  assert archival.reload.archived?
28
28
  assert exploder.reload.archived?
29
29
  end
30
30
 
31
- test "mysql archiving is transactional" do
32
- archival = MysqlArchival.create!
33
- exploder = archival.exploders.create!
34
- any_instance_of(MysqlExploder) do |canary|
35
- stub(canary).unarchive { raise "Rollback Imminent" }
36
- end
37
- archival.archive
38
- archival.unarchive
39
-
40
- assert archival.reload.archived?
41
- assert exploder.reload.archived?
42
- end
43
-
44
- test "mysql unarchiving is transactional" do
45
- archival = MysqlArchival.create!
46
- exploder = archival.exploders.create!
47
- any_instance_of(MysqlExploder) do |canary|
48
- stub(canary).unarchive { raise "Rollback Imminent" }
49
- end
50
- archival.archive
51
- archival.unarchive
52
-
53
- assert archival.reload.archived?
54
- assert exploder.reload.archived?
55
- end
56
-
57
- test "postgres archiving is transactional" do
58
- archival = MysqlArchival.create!
59
- exploder = archival.exploders.create!
60
- any_instance_of(MysqlExploder) do |canary|
61
- stub(canary).unarchive { raise "Rollback Imminent" }
62
- end
63
- archival.archive
64
- archival.unarchive
65
-
66
- assert archival.reload.archived?
67
- assert exploder.reload.archived?
68
- end
69
-
70
- test "postgres unarchiving is transactional" do
71
- archival = MysqlArchival.create!
72
- exploder = archival.exploders.create!
73
- any_instance_of(MysqlExploder) do |canary|
74
- stub(canary).unarchive { raise "Rollback Imminent" }
75
- end
76
- archival.archive
77
- archival.unarchive
78
-
79
- assert archival.reload.archived?
80
- assert exploder.reload.archived?
81
- end
82
31
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: acts_as_archival
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joel Meador
@@ -13,10 +13,15 @@ authors:
13
13
  - Miles Sterrett
14
14
  - James Hill
15
15
  - Maarten Claes
16
- autorequire:
16
+ - Anthony Panozzo
17
+ - Aaron Milam
18
+ - Anton Rieder
19
+ - Josh Menden
20
+ - Sergey Gnuskov
21
+ autorequire:
17
22
  bindir: bin
18
23
  cert_chain: []
19
- date: 2016-04-10 00:00:00.000000000 Z
24
+ date: 2021-10-19 00:00:00.000000000 Z
20
25
  dependencies:
21
26
  - !ruby/object:Gem::Dependency
22
27
  name: activerecord
@@ -24,14 +29,14 @@ dependencies:
24
29
  requirements:
25
30
  - - ">="
26
31
  - !ruby/object:Gem::Version
27
- version: '0'
32
+ version: '5.0'
28
33
  type: :runtime
29
34
  prerelease: false
30
35
  version_requirements: !ruby/object:Gem::Requirement
31
36
  requirements:
32
37
  - - ">="
33
38
  - !ruby/object:Gem::Version
34
- version: '0'
39
+ version: '5.0'
35
40
  - !ruby/object:Gem::Dependency
36
41
  name: appraisal
37
42
  requirement: !ruby/object:Gem::Requirement
@@ -75,21 +80,7 @@ dependencies:
75
80
  - !ruby/object:Gem::Version
76
81
  version: '0'
77
82
  - !ruby/object:Gem::Dependency
78
- name: mysql2
79
- requirement: !ruby/object:Gem::Requirement
80
- requirements:
81
- - - ">="
82
- - !ruby/object:Gem::Version
83
- version: '0'
84
- type: :development
85
- prerelease: false
86
- version_requirements: !ruby/object:Gem::Requirement
87
- requirements:
88
- - - ">="
89
- - !ruby/object:Gem::Version
90
- version: '0'
91
- - !ruby/object:Gem::Dependency
92
- name: pg
83
+ name: rake
93
84
  requirement: !ruby/object:Gem::Requirement
94
85
  requirements:
95
86
  - - ">="
@@ -103,7 +94,7 @@ dependencies:
103
94
  - !ruby/object:Gem::Version
104
95
  version: '0'
105
96
  - !ruby/object:Gem::Dependency
106
- name: rake
97
+ name: rr
107
98
  requirement: !ruby/object:Gem::Requirement
108
99
  requirements:
109
100
  - - ">="
@@ -117,19 +108,19 @@ dependencies:
117
108
  - !ruby/object:Gem::Version
118
109
  version: '0'
119
110
  - !ruby/object:Gem::Dependency
120
- name: rr
111
+ name: rubocop
121
112
  requirement: !ruby/object:Gem::Requirement
122
113
  requirements:
123
- - - ">="
114
+ - - "~>"
124
115
  - !ruby/object:Gem::Version
125
- version: '0'
116
+ version: 0.82.0
126
117
  type: :development
127
118
  prerelease: false
128
119
  version_requirements: !ruby/object:Gem::Requirement
129
120
  requirements:
130
- - - ">="
121
+ - - "~>"
131
122
  - !ruby/object:Gem::Version
132
- version: '0'
123
+ version: 0.82.0
133
124
  - !ruby/object:Gem::Dependency
134
125
  name: sqlite3
135
126
  requirement: !ruby/object:Gem::Requirement
@@ -156,7 +147,7 @@ description: |
156
147
  easily restore or remove an entire set of records without having to worry about
157
148
  partial deletion or restoration.
158
149
 
159
- Additionally, other plugins generally screw with how destroy/delete work. We
150
+ Additionally, other plugins generally screw with how destroy/delete work. We
160
151
  don't because we actually want to be able to destroy records.
161
152
  email:
162
153
  - joel@expectedbehavior.com
@@ -168,16 +159,20 @@ extensions: []
168
159
  extra_rdoc_files: []
169
160
  files:
170
161
  - ".gitignore"
162
+ - ".rubocop.yml"
163
+ - ".rubocop_todo.yml"
164
+ - ".travis.yml"
171
165
  - Appraisals
172
166
  - CHANGELOG.md
173
167
  - Gemfile
168
+ - Gemfile.lock
174
169
  - LICENSE
175
170
  - README.md
176
171
  - Rakefile
177
172
  - acts_as_archival.gemspec
178
- - gemfiles/rails_4.1.gemfile
179
- - gemfiles/rails_4.2.gemfile
180
- - gemfiles/rails_5.0.gemfile
173
+ - gemfiles/rails_5.2.gemfile
174
+ - gemfiles/rails_6.0.gemfile
175
+ - gemfiles/rails_6.1.gemfile
181
176
  - init.rb
182
177
  - lib/acts_as_archival.rb
183
178
  - lib/acts_as_archival/version.rb
@@ -186,7 +181,6 @@ files:
186
181
  - lib/expected_behavior/association_operation/archive.rb
187
182
  - lib/expected_behavior/association_operation/base.rb
188
183
  - lib/expected_behavior/association_operation/unarchive.rb
189
- - script/db_setup
190
184
  - script/setup
191
185
  - test/ambiguous_table_test.rb
192
186
  - test/application_record_test.rb
@@ -194,8 +188,8 @@ files:
194
188
  - test/basic_test.rb
195
189
  - test/callbacks_test.rb
196
190
  - test/column_test.rb
197
- - test/database.yml
198
191
  - test/deep_nesting_test.rb
192
+ - test/fixtures/another_polys_holder.rb
199
193
  - test/fixtures/application_record.rb
200
194
  - test/fixtures/application_record_row.rb
201
195
  - test/fixtures/archival.rb
@@ -206,19 +200,14 @@ files:
206
200
  - test/fixtures/callback_archival_5.rb
207
201
  - test/fixtures/exploder.rb
208
202
  - test/fixtures/independent_archival.rb
209
- - test/fixtures/mass_attribute_protected.rb
210
203
  - test/fixtures/missing_archive_number.rb
211
204
  - test/fixtures/missing_archived_at.rb
212
- - test/fixtures/mysql_archival.rb
213
- - test/fixtures/mysql_exploder.rb
214
- - test/fixtures/pg_archival.rb
215
- - test/fixtures/pg_exploder.rb
216
205
  - test/fixtures/plain.rb
217
206
  - test/fixtures/poly.rb
218
207
  - test/fixtures/readonly_when_archived.rb
219
- - test/mass_attribute_test.rb
220
208
  - test/polymorphic_test.rb
221
209
  - test/readonly_when_archived_test.rb
210
+ - test/relations_test.rb
222
211
  - test/responds_test.rb
223
212
  - test/schema.rb
224
213
  - test/scope_test.rb
@@ -228,7 +217,7 @@ files:
228
217
  homepage: http://github.com/expectedbehavior/acts_as_archival
229
218
  licenses: []
230
219
  metadata: {}
231
- post_install_message:
220
+ post_install_message:
232
221
  rdoc_options: []
233
222
  require_paths:
234
223
  - lib
@@ -236,16 +225,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
236
225
  requirements:
237
226
  - - ">="
238
227
  - !ruby/object:Gem::Version
239
- version: '0'
228
+ version: '2.4'
240
229
  required_rubygems_version: !ruby/object:Gem::Requirement
241
230
  requirements:
242
231
  - - ">="
243
232
  - !ruby/object:Gem::Version
244
233
  version: '0'
245
234
  requirements: []
246
- rubyforge_project:
247
- rubygems_version: 2.5.1
248
- signing_key:
235
+ rubygems_version: 3.1.2
236
+ signing_key:
249
237
  specification_version: 4
250
238
  summary: Atomic archiving/unarchiving for ActiveRecord-based apps
251
239
  test_files:
@@ -255,8 +243,8 @@ test_files:
255
243
  - test/basic_test.rb
256
244
  - test/callbacks_test.rb
257
245
  - test/column_test.rb
258
- - test/database.yml
259
246
  - test/deep_nesting_test.rb
247
+ - test/fixtures/another_polys_holder.rb
260
248
  - test/fixtures/application_record.rb
261
249
  - test/fixtures/application_record_row.rb
262
250
  - test/fixtures/archival.rb
@@ -267,19 +255,14 @@ test_files:
267
255
  - test/fixtures/callback_archival_5.rb
268
256
  - test/fixtures/exploder.rb
269
257
  - test/fixtures/independent_archival.rb
270
- - test/fixtures/mass_attribute_protected.rb
271
258
  - test/fixtures/missing_archive_number.rb
272
259
  - test/fixtures/missing_archived_at.rb
273
- - test/fixtures/mysql_archival.rb
274
- - test/fixtures/mysql_exploder.rb
275
- - test/fixtures/pg_archival.rb
276
- - test/fixtures/pg_exploder.rb
277
260
  - test/fixtures/plain.rb
278
261
  - test/fixtures/poly.rb
279
262
  - test/fixtures/readonly_when_archived.rb
280
- - test/mass_attribute_test.rb
281
263
  - test/polymorphic_test.rb
282
264
  - test/readonly_when_archived_test.rb
265
+ - test/relations_test.rb
283
266
  - test/responds_test.rb
284
267
  - test/schema.rb
285
268
  - test/scope_test.rb
@@ -1,8 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "rails", "~> 4.1.0"
6
- gem "mysql2", ">= 0.3.13", "< 0.4"
7
-
8
- gemspec :path => "../"
data/script/db_setup DELETED
@@ -1,51 +0,0 @@
1
- #!/usr/bin/env ruby
2
- require "bundler/setup"
3
- require "yaml"
4
-
5
- STDOUT.sync = true
6
-
7
- DB_CONFIG = YAML.load(File.read(File.join(File.dirname(__FILE__), "..", "test", "database.yml")))
8
-
9
- def execute_mysql(statement, password = nil)
10
- password_option = if password.to_s.size > 0
11
- "-p'#{password}'"
12
- end
13
- command = %Q{echo '#{statement}' | mysql -u root #{password_option}}
14
- puts command
15
- system(command)
16
- end
17
-
18
- def execute_postgres(statement)
19
- command = %Q{echo "#{statement}" | psql postgres}
20
- puts command
21
- system(command)
22
- end
23
-
24
- def setup_mysql
25
- mysql_root_password = nil
26
- if !execute_mysql("SHOW DATABASES;", mysql_root_password)
27
- loop do
28
- print "MySQL root password to setup '#{DB_CONFIG["mysql"]["database"]}': "
29
- mysql_root_password = gets.chomp
30
- if execute_mysql("SHOW DATABASES;", mysql_root_password)
31
- break
32
- end
33
- end
34
- end
35
-
36
- config = DB_CONFIG["mysql"]
37
- execute_mysql("DROP DATABASE IF EXISTS #{config["database"]};", mysql_root_password)
38
- execute_mysql("CREATE DATABASE #{config["database"]};", mysql_root_password)
39
- execute_mysql(%Q{GRANT ALL ON `#{config["database"]}`.* TO `#{config["username"]}` IDENTIFIED BY "#{config["password"]}";}, mysql_root_password)
40
- end
41
-
42
- def setup_postgres
43
- config = DB_CONFIG["pg"]
44
- execute_postgres(%Q{DROP DATABASE IF EXISTS #{config["database"]};})
45
- execute_postgres(%Q{DROP ROLE IF EXISTS #{config["username"]};})
46
- execute_postgres(%Q{CREATE ROLE #{config["username"]} WITH PASSWORD '#{config["password"]}' LOGIN;})
47
- execute_postgres(%Q{CREATE DATABASE #{config["database"]} WITH OWNER #{config["username"]};})
48
- end
49
-
50
- setup_mysql
51
- setup_postgres
data/test/database.yml DELETED
@@ -1,26 +0,0 @@
1
- sqlite:
2
- adapter: sqlite3
3
- database: aaa_test.sqlite3
4
- pool: 5
5
- timeout: 5000
6
-
7
- mysql:
8
- adapter: mysql2
9
- pool: 5
10
- timeout: 5000
11
- encoding: utf8
12
- reconnect: false
13
- database: aaa_test
14
- username: archival_tester
15
- password: perspicacious
16
- socket: /tmp/mysql.sock
17
-
18
- pg:
19
- adapter: postgresql
20
- pool: 5
21
- timeout: 5000
22
- encoding: utf8
23
- database: aaa_test
24
- username: archival_tester
25
- password: perspicacious
26
- min_messages: WARNING
@@ -1,7 +0,0 @@
1
- # name - string
2
- # archive_number - string
3
- # archived_at - datetime
4
- class MassAttributeProtected < ActiveRecord::Base
5
- acts_as_archival
6
- attr_accessible :name
7
- end
@@ -1,10 +0,0 @@
1
- # name - string
2
- # archival_id - integer
3
- # archive_number - string
4
- # archived_at - datetime
5
- class MysqlArchival < ActiveRecord::Base
6
- establish_connection $dbconfig["mysql"]
7
- self.table_name = "archivals"
8
- acts_as_archival
9
- has_many :exploders, :dependent => :destroy, :foreign_key => :archival_id, :class_name => "MysqlExploder"
10
- end