acts_as_archival 1.0.0 → 1.1.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: cff5862053f75da82a37e18eb5f014118fcc4702
4
- data.tar.gz: a3289e80a677888517c5862d4905f2cbb44aad0f
3
+ metadata.gz: aa2576c02d786c7c0a1606422faa3cdd78a9aaf7
4
+ data.tar.gz: 0483e19ed7a866d4a39db48f80fe9d980c362d10
5
5
  SHA512:
6
- metadata.gz: 175eb9267a176e8047d4f23b6e5bd4c3c25e496f4ce4bcb61d61ccafd93ae5fddf2f6b9a9ece625a68bd76df83c82cb8e6b110ccec1ad958f37663aeeed11eba
7
- data.tar.gz: f9abce355fe369749c02bf609ad2abfbfad7e482fb3393c3d12bdf9ef13b99fd80afdaa0ad83bcb9e512ae57f3527510d8279a4f8989f269a0b1a055fbdadf73
6
+ metadata.gz: a4d293356b16111c7c5bb9524d98a72fe401830afbbac1ae061d6a9577d69f80e6131533c495ff62ad86cd44a082aa0badb5d34995285bc359d8486d5bdebca9
7
+ data.tar.gz: d53ad14039ae0e8675071c5756e780984efafc0a19180f75882c71657ca613a17b949519b37e32fadcf1ea7a5c2cf386701fe8c37d9c7e46acbf4801fde67501
data/Appraisals CHANGED
@@ -1,11 +1,12 @@
1
- appraise "rails-3" do
2
- gem "rails", ">= 3.0.0", "< 4.0"
1
+ appraise "rails-4.1" do
2
+ gem "rails", "~> 4.1.0"
3
+ gem "mysql2", ">= 0.3.13", "< 0.4"
3
4
  end
4
5
 
5
- appraise "rails-4" do
6
- gem "rails", "~> 4.0.0"
6
+ appraise "rails-4.2" do
7
+ gem "rails", "~> 4.2.0"
7
8
  end
8
9
 
9
- appraise "rails-4.1" do
10
- gem "rails", "~> 4.1.0"
10
+ appraise "rails-5.0" do
11
+ gem "rails", "~> 5.0.0.beta3"
11
12
  end
@@ -1,20 +1,28 @@
1
1
  # CHANGELOG
2
2
 
3
- ## 1.0.0
3
+ ## 1.1.0 - April 10, 2016
4
+ * **BREAKING CHANGE** obsolete mainline rails 3 and rails 4.0.x support because: they are EOL'ed for > 1y
5
+ * add rails 4.2 automated tests
6
+ * add rails 5 support
7
+ * test and document callbacks better - Thanks, Aaron Milam
8
+ * **BUGFIX** remove a bunch of deprecations
9
+ * **BUGFIX** improve compatibility with various new versions of software like mysql when testing
10
+
11
+ ## 1.0.0 - April 5, 2016
4
12
  * **BREAKING CHANGE** make `#archived?` return an actual boolean value
5
13
 
6
- ## 0.6.1
14
+ ## 0.6.1 - July 24, 2014
7
15
  * Fix deprecation warnings on Rails 4.1
8
16
  * Test suite now runs against multiple versions of Rails
9
17
  * Fully automated test suite setup
10
18
 
11
- ## 0.6.0
19
+ ## 0.6.0 - April 14, 2014
12
20
  * **BREAKING CHANGE** (possibly): Some refactoring to modern gem module idioms instead of old school plugins
13
21
  * Officially support PostgreSQL
14
22
  * Switch default testing to use sqlite, mysql, and postgres instead of just mysql
15
23
  * Major upgrades to test suite
16
24
 
17
- ## 0.5.3
25
+ ## 0.5.3 - May 17, 2013
18
26
  * Major refactoring of archiving/unarchiving logic into nice command classes instead of big ball of ARec voodoo. Thanks, Marten Claes!
19
27
 
20
28
  ## 0.5.2
data/README.md CHANGED
@@ -31,7 +31,7 @@ i.e. `rails g migration AddAAAToPost archive_number archived_at:datetime`
31
31
 
32
32
  Any dependent-destroy AAA model associated to an AAA model will be archived with its parent.
33
33
 
34
- _If you're stuck on Rails 3x/2x, check out the available branches, which are no longer in active development._
34
+ _If you're stuck on Rails 4.0x/3x/2x, check out the older tags/branches, which are no longer in active development._
35
35
 
36
36
  ## Example
37
37
 
@@ -135,15 +135,13 @@ end
135
135
 
136
136
  #### Halting the callback chain
137
137
 
138
- The callback method should return a `false` value.
138
+ * Rails 4.1/4.2 - the callback method should return a `false`/`nil` value.
139
+ * Rails 5x - the callback should `throw(:abort)`/`raise(:abort)`.
139
140
 
140
141
  ## Caveats
141
142
 
142
143
  1. This will only work on associations that are dependent destroy. It
143
144
  should be trival to change that or make it optional.
144
- 1. It will only work for Rails 2.2 and up, because we are using
145
- `named_scope`/`scope`. You can check out [permanent records](http://github.com/fastestforward/permanent_records) for a way
146
- to conditionally add the functionality to older Rails installations.
147
145
  1. If you would like to work on this, you will need to setup sqlite, postgres, and mysql on your development machine. Alternately, you can disable specific dev dependencies in the gemspec and test_helper and ask for help.
148
146
 
149
147
  ## Testing
@@ -156,6 +154,8 @@ rake # run tests on latest Rails
156
154
  appraisal rake # run tests on all versions of Rails
157
155
  ```
158
156
 
157
+ Check out [more on appraisal](https://github.com/thoughtbot/appraisal#usage) if you need to add new versions of things or run into a version bug.
158
+
159
159
  ## Help Wanted
160
160
 
161
161
  We'd love to have your help making this better! If you have ideas for features this should implement or you think the code sucks, let us know. And PRs are greatly appreciated. :+1:
@@ -178,6 +178,7 @@ ActsAsParanoid and PermanentRecords were both inspirations for this:
178
178
  * Miles Sterrett
179
179
  * James Hill
180
180
  * Maarten Claes
181
+ * Aaron Milam
181
182
 
182
183
  Thanks!
183
184
 
@@ -29,13 +29,12 @@ Gem::Specification.new do |gem|
29
29
 
30
30
  gem.add_development_dependency "appraisal"
31
31
  gem.add_development_dependency "assertions-eb"
32
- gem.add_development_dependency "rake"
32
+ gem.add_development_dependency "database_cleaner"
33
33
  gem.add_development_dependency "mysql2"
34
- gem.add_development_dependency "sqlite3"
35
34
  gem.add_development_dependency "pg"
35
+ gem.add_development_dependency "rake"
36
36
  gem.add_development_dependency "rr"
37
- gem.add_development_dependency "database_cleaner"
38
-
37
+ gem.add_development_dependency "sqlite3"
39
38
 
40
39
  gem.description = <<-END
41
40
  *Atomic archiving/unarchiving for ActiveRecord-based apps*
@@ -3,5 +3,6 @@
3
3
  source "https://rubygems.org"
4
4
 
5
5
  gem "rails", "~> 4.1.0"
6
+ gem "mysql2", ">= 0.3.13", "< 0.4"
6
7
 
7
8
  gemspec :path => "../"
@@ -2,6 +2,6 @@
2
2
 
3
3
  source "https://rubygems.org"
4
4
 
5
- gem "rails", "~> 4.0.0"
5
+ gem "rails", "~> 4.2.0"
6
6
 
7
7
  gemspec :path => "../"
@@ -2,6 +2,6 @@
2
2
 
3
3
  source "https://rubygems.org"
4
4
 
5
- gem "rails", ">= 3.0.0", "< 4.0"
5
+ gem "rails", "~> 5.0.0.beta3"
6
6
 
7
7
  gemspec :path => "../"
@@ -7,5 +7,11 @@ require "expected_behavior/association_operation/unarchive"
7
7
  require "expected_behavior/acts_as_archival"
8
8
  require "expected_behavior/acts_as_archival_active_record_methods"
9
9
 
10
- ActiveRecord::Base.send :include, ExpectedBehavior::ActsAsArchival
11
- ActiveRecord::Base.send :include, ExpectedBehavior::ActsAsArchivalActiveRecordMethods
10
+ # This assumes a fully Rails 5 compatible set of ActiveRecord models
11
+ if defined?(ApplicationRecord)
12
+ ApplicationRecord.send :include, ExpectedBehavior::ActsAsArchival
13
+ ApplicationRecord.send :include, ExpectedBehavior::ActsAsArchivalActiveRecordMethods
14
+ else
15
+ ActiveRecord::Base.send :include, ExpectedBehavior::ActsAsArchival
16
+ ActiveRecord::Base.send :include, ExpectedBehavior::ActsAsArchivalActiveRecordMethods
17
+ end
@@ -1,3 +1,3 @@
1
1
  module ActsAsArchival
2
- VERSION = "1.0.0"
2
+ VERSION = "1.1.0"
3
3
  end
@@ -23,14 +23,22 @@ module ExpectedBehavior
23
23
  scope :archived_from_archive_number, lambda { |head_archive_number| where(['archived_at IS NOT NULL AND archive_number = ?', head_archive_number]) }
24
24
 
25
25
  callbacks = ['archive','unarchive']
26
- define_callbacks *[callbacks, {:terminator => lambda { |_, result| result == false }}].flatten
26
+ if ActiveSupport::VERSION::STRING >= '5'
27
+ define_callbacks(*[callbacks].flatten)
28
+ elsif ActiveSupport::VERSION::STRING >= '4'
29
+ define_callbacks(*[callbacks, {:terminator => -> (_, result) { result == false }}].flatten)
30
+ end
27
31
  callbacks.each do |callback|
28
32
  eval <<-end_callbacks
29
- def before_#{callback}(*args, &blk)
30
- set_callback(:#{callback}, :before, *args, &blk)
33
+ unless defined?(before_#{callback})
34
+ def before_#{callback}(*args, &blk)
35
+ set_callback(:#{callback}, :before, *args, &blk)
36
+ end
31
37
  end
32
- def after_#{callback}(*args, &blk)
33
- set_callback(:#{callback}, :after, *args, &blk)
38
+ unless defined?(after_#{callback})
39
+ def after_#{callback}(*args, &blk)
40
+ set_callback(:#{callback}, :after, *args, &blk)
41
+ end
34
42
  end
35
43
  end_callbacks
36
44
  end
@@ -61,7 +69,7 @@ module ExpectedBehavior
61
69
  def archive(head_archive_number=nil)
62
70
  self.class.transaction do
63
71
  begin
64
- run_callbacks :archive do
72
+ success = run_callbacks(:archive) do
65
73
  unless self.archived?
66
74
  head_archive_number ||= Digest::MD5.hexdigest("#{self.class.name}#{self.id}")
67
75
  self.archive_associations(head_archive_number)
@@ -70,7 +78,7 @@ module ExpectedBehavior
70
78
  self.save!
71
79
  end
72
80
  end
73
- return true
81
+ return !!success
74
82
  rescue => e
75
83
  ActiveRecord::Base.logger.try(:debug, e.message)
76
84
  ActiveRecord::Base.logger.try(:debug, e.backtrace)
@@ -83,7 +91,7 @@ module ExpectedBehavior
83
91
  def unarchive(head_archive_number=nil)
84
92
  self.class.transaction do
85
93
  begin
86
- run_callbacks :unarchive do
94
+ success = run_callbacks(:unarchive) do
87
95
  if self.archived?
88
96
  head_archive_number ||= self.archive_number
89
97
  self.archived_at = nil
@@ -92,7 +100,7 @@ module ExpectedBehavior
92
100
  self.unarchive_associations(head_archive_number)
93
101
  end
94
102
  end
95
- return true
103
+ return !!success
96
104
  rescue => e
97
105
  ActiveRecord::Base.logger.try(:debug, e.message)
98
106
  ActiveRecord::Base.logger.try(:debug, e.backtrace)
@@ -2,5 +2,11 @@
2
2
  set -e
3
3
  cd "`dirname \"$0\"`/.."
4
4
 
5
+ echo "\n---=== Bundling ===---"
5
6
  bundle install
7
+
8
+ echo "\n---=== Setting up test databases ===---"
6
9
  script/db_setup
10
+
11
+ echo "\n---=== Setting up various rails versions for testing ===---"
12
+ bundle exec appraisal install
@@ -0,0 +1,18 @@
1
+ require_relative "test_helper"
2
+
3
+ # Rails 5 introduced a new base class, and this is gonna test that
4
+ if defined?(ApplicationRecord)
5
+ class ApplicationRecordTest < ActiveSupport::TestCase
6
+ test "archive archives the record" do
7
+ archival = ApplicationRecordRow.create!
8
+ archival.archive
9
+ assert archival.reload.archived?
10
+ end
11
+
12
+ test "unarchive unarchives archival records" do
13
+ archival = ApplicationRecordRow.create!(:archived_at => Time.now, :archive_number => 1)
14
+ archival.unarchive
15
+ assert_not archival.reload.archived?
16
+ end
17
+ end
18
+ end
@@ -21,7 +21,7 @@ class AssociationsTest < ActiveSupport::TestCase
21
21
 
22
22
  test "archive does not act on already archived objects" do
23
23
  archival = Archival.create!
24
- child = archival.archivals.create!
24
+ archival.archivals.create!
25
25
  prearchived_child = archival.archivals.create!
26
26
  prearchived_child.archive
27
27
  archival.archive
@@ -0,0 +1,39 @@
1
+ require_relative "test_helper"
2
+
3
+ class CallbacksTest < ActiveSupport::TestCase
4
+ if defined?(ApplicationRecord)
5
+ test "can set a value as part of archiving" do
6
+ archival = CallbackArchival5.create
7
+ archival.set_this_value = "a test string"
8
+ assert_nil archival.settable_field
9
+ archival.archive
10
+ assert_equal "a test string", archival.reload.settable_field
11
+ end
12
+
13
+ test "can be halted" do
14
+ archival = archival = CallbackArchival5.create
15
+ archival.set_this_value = "a test string"
16
+ archival.pass_callback = false
17
+ assert_nil archival.settable_field
18
+ archival.archive
19
+ assert_nil archival.reload.settable_field
20
+ end
21
+ else
22
+ test "can set a value as part of archiving" do
23
+ archival = CallbackArchival4.create
24
+ archival.set_this_value = "a test string"
25
+ assert_nil archival.settable_field
26
+ archival.archive
27
+ assert_equal "a test string", archival.reload.settable_field
28
+ end
29
+
30
+ test "can be halted" do
31
+ archival = archival = CallbackArchival4.create
32
+ archival.set_this_value = "a test string"
33
+ archival.pass_callback = false
34
+ assert_nil archival.settable_field
35
+ archival.archive
36
+ assert_nil archival.reload.settable_field
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,3 @@
1
+ class ApplicationRecord < ActiveRecord::Base
2
+ self.abstract_class = true
3
+ end
@@ -0,0 +1,6 @@
1
+ # Rails 5 introduced a new base class, and this is gonna be used in the tests of that
2
+ if defined?(ApplicationRecord)
3
+ class ApplicationRecordRow < ApplicationRecord
4
+ acts_as_archival
5
+ end
6
+ end
@@ -0,0 +1,17 @@
1
+ class CallbackArchival4 < ActiveRecord::Base
2
+ acts_as_archival
3
+
4
+ attr_accessor :set_this_value,
5
+ :pass_callback
6
+
7
+ before_archive :set_value,
8
+ :conditional_callback_passer
9
+
10
+ private def set_value
11
+ self.settable_field = set_this_value
12
+ end
13
+
14
+ private def conditional_callback_passer
15
+ pass_callback || pass_callback.nil?
16
+ end
17
+ end
@@ -0,0 +1,20 @@
1
+ # necessary for ApplicationRecord
2
+ if defined?(ApplicationRecord)
3
+ class CallbackArchival5 < ApplicationRecord
4
+ acts_as_archival
5
+
6
+ attr_accessor :set_this_value,
7
+ :pass_callback
8
+
9
+ before_archive :set_value,
10
+ :conditional_callback_passer
11
+
12
+ private def set_value
13
+ self.settable_field = set_this_value
14
+ end
15
+
16
+ private def conditional_callback_passer
17
+ throw(:abort) unless (pass_callback || pass_callback.nil?)
18
+ end
19
+ end
20
+ end
@@ -1,3 +1,11 @@
1
+ # Rails 4.0 and before do not deal correctly with newer versions of mysql, so we're
2
+ # gonna force a non-null primary ID for old versions of Rails just as new ones do.
3
+ if (ActiveRecord.version <=> Gem::Version.new("4.1.0")) < 0
4
+ class ActiveRecord::ConnectionAdapters::Mysql2Adapter
5
+ NATIVE_DATABASE_TYPES[:primary_key] = "int(11) auto_increment PRIMARY KEY"
6
+ end
7
+ end
8
+
1
9
  ActiveRecord::Schema.define(:version => 1) do
2
10
  create_table :archivals, :force => true do |t|
3
11
  t.column :name, :string
@@ -12,6 +20,10 @@ ActiveRecord::Schema.define(:version => 1) do
12
20
  t.column :archived_at, :datetime
13
21
  end
14
22
 
23
+ ###
24
+ # The classes above are used to test database-specific
25
+ # things in PG and MySQL, and we don't need to do all
26
+ # the tests there.
15
27
  if "SQLite" == ActiveRecord::Base.connection.adapter_name
16
28
  create_table :archival_kids, :force => true do |t|
17
29
  t.column :archival_id, :integer
@@ -70,5 +82,22 @@ ActiveRecord::Schema.define(:version => 1) do
70
82
  t.column :archive_number, :string
71
83
  t.column :archived_at, :datetime
72
84
  end
85
+
86
+ create_table :application_record_rows, :force => true do |t|
87
+ t.column :archive_number, :string
88
+ t.column :archived_at, :datetime
89
+ end
90
+
91
+ create_table :callback_archival4s, :force => true do |t|
92
+ t.column :settable_field, :string
93
+ t.column :archive_number, :string
94
+ t.column :archived_at, :datetime
95
+ end
96
+
97
+ create_table :callback_archival5s, :force => true do |t|
98
+ t.column :settable_field, :string
99
+ t.column :archive_number, :string
100
+ t.column :archived_at, :datetime
101
+ end
73
102
  end
74
103
  end
@@ -49,8 +49,14 @@ class ScopeTest < ActiveSupport::TestCase
49
49
  end
50
50
 
51
51
  test "table_name is set to 'legacy'" do
52
- archived_sql = %Q{SELECT "legacy".* FROM "legacy" WHERE (legacy.archived_at IS NOT NULL AND legacy.archive_number IS NOT NULL)}
53
- unarchived_sql = %Q{SELECT "legacy".* FROM "legacy" WHERE "legacy"."archived_at" IS NULL AND "legacy"."archive_number" IS NULL}
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
60
  assert_equal archived_sql, ArchivalTableName.archived.to_sql
55
61
  assert_equal unarchived_sql, ArchivalTableName.unarchived.to_sql
56
62
  end
@@ -8,6 +8,10 @@ require "database_cleaner"
8
8
 
9
9
  require "acts_as_archival"
10
10
 
11
+ if ActiveSupport::TestCase.respond_to?(:test_order=)
12
+ ActiveSupport::TestCase.test_order = :random
13
+ end
14
+
11
15
  def prepare_for_tests
12
16
  setup_logging# if ENV["LOGGING_ENABLED"]
13
17
  setup_active_record
@@ -48,22 +52,31 @@ def require_test_classes
48
52
  inflect.irregular "poly", "polys"
49
53
  end
50
54
 
51
- fixtures = [:archival,
52
- :archival_kid,
53
- :archival_grandkid,
54
- :archival_table_name,
55
- :exploder,
56
- :independent_archival,
57
- :plain,
58
- :missing_archived_at,
59
- :missing_archive_number,
60
- :mysql_archival,
61
- :mysql_exploder,
62
- :plain,
63
- :poly,
64
- :pg_archival,
65
- :pg_exploder,
66
- :readonly_when_archived]
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
62
+
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
+ ]
67
80
  $require_mass_protection = ActiveModel.constants.include?(:MassAssignmentSecurity)
68
81
  fixtures << :mass_attribute_protected if $require_mass_protection
69
82
  fixtures.each {|test_class_file| require_relative "fixtures/#{test_class_file}"}
@@ -2,13 +2,12 @@ require_relative "test_helper"
2
2
  require "rr"
3
3
 
4
4
  class TransactionTest < ActiveSupport::TestCase
5
- include RR::Adapters::TestUnit
6
5
 
7
6
  test "sqlite archiving is transactional" do
8
7
  archival = Archival.create!
9
8
  exploder = archival.exploders.create!
10
- any_instance_of(Exploder) do |exploder|
11
- stub(exploder).archive { raise "Rollback Imminent" }
9
+ any_instance_of(Exploder) do |canary|
10
+ stub(canary).archive { raise "Rollback Imminent" }
12
11
  end
13
12
  archival.archive
14
13
 
@@ -19,8 +18,8 @@ class TransactionTest < ActiveSupport::TestCase
19
18
  test "sqlite unarchiving is transactional" do
20
19
  archival = Archival.create!
21
20
  exploder = archival.exploders.create!
22
- any_instance_of(Exploder) do |exploder|
23
- stub(exploder).unarchive { raise "Rollback Imminent" }
21
+ any_instance_of(Exploder) do |canary|
22
+ stub(canary).unarchive { raise "Rollback Imminent" }
24
23
  end
25
24
  archival.archive
26
25
  archival.unarchive
@@ -32,8 +31,8 @@ class TransactionTest < ActiveSupport::TestCase
32
31
  test "mysql archiving is transactional" do
33
32
  archival = MysqlArchival.create!
34
33
  exploder = archival.exploders.create!
35
- any_instance_of(MysqlExploder) do |exploder|
36
- stub(exploder).unarchive { raise "Rollback Imminent" }
34
+ any_instance_of(MysqlExploder) do |canary|
35
+ stub(canary).unarchive { raise "Rollback Imminent" }
37
36
  end
38
37
  archival.archive
39
38
  archival.unarchive
@@ -45,8 +44,8 @@ class TransactionTest < ActiveSupport::TestCase
45
44
  test "mysql unarchiving is transactional" do
46
45
  archival = MysqlArchival.create!
47
46
  exploder = archival.exploders.create!
48
- any_instance_of(MysqlExploder) do |exploder|
49
- stub(exploder).unarchive { raise "Rollback Imminent" }
47
+ any_instance_of(MysqlExploder) do |canary|
48
+ stub(canary).unarchive { raise "Rollback Imminent" }
50
49
  end
51
50
  archival.archive
52
51
  archival.unarchive
@@ -58,8 +57,8 @@ class TransactionTest < ActiveSupport::TestCase
58
57
  test "postgres archiving is transactional" do
59
58
  archival = MysqlArchival.create!
60
59
  exploder = archival.exploders.create!
61
- any_instance_of(MysqlExploder) do |exploder|
62
- stub(exploder).unarchive { raise "Rollback Imminent" }
60
+ any_instance_of(MysqlExploder) do |canary|
61
+ stub(canary).unarchive { raise "Rollback Imminent" }
63
62
  end
64
63
  archival.archive
65
64
  archival.unarchive
@@ -71,8 +70,8 @@ class TransactionTest < ActiveSupport::TestCase
71
70
  test "postgres unarchiving is transactional" do
72
71
  archival = MysqlArchival.create!
73
72
  exploder = archival.exploders.create!
74
- any_instance_of(MysqlExploder) do |exploder|
75
- stub(exploder).unarchive { raise "Rollback Imminent" }
73
+ any_instance_of(MysqlExploder) do |canary|
74
+ stub(canary).unarchive { raise "Rollback Imminent" }
76
75
  end
77
76
  archival.archive
78
77
  archival.unarchive
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.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joel Meador
@@ -16,7 +16,7 @@ authors:
16
16
  autorequire:
17
17
  bindir: bin
18
18
  cert_chain: []
19
- date: 2016-04-05 00:00:00.000000000 Z
19
+ date: 2016-04-10 00:00:00.000000000 Z
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
22
22
  name: activerecord
@@ -61,7 +61,7 @@ dependencies:
61
61
  - !ruby/object:Gem::Version
62
62
  version: '0'
63
63
  - !ruby/object:Gem::Dependency
64
- name: rake
64
+ name: database_cleaner
65
65
  requirement: !ruby/object:Gem::Requirement
66
66
  requirements:
67
67
  - - ">="
@@ -89,7 +89,7 @@ dependencies:
89
89
  - !ruby/object:Gem::Version
90
90
  version: '0'
91
91
  - !ruby/object:Gem::Dependency
92
- name: sqlite3
92
+ name: pg
93
93
  requirement: !ruby/object:Gem::Requirement
94
94
  requirements:
95
95
  - - ">="
@@ -103,7 +103,7 @@ dependencies:
103
103
  - !ruby/object:Gem::Version
104
104
  version: '0'
105
105
  - !ruby/object:Gem::Dependency
106
- name: pg
106
+ name: rake
107
107
  requirement: !ruby/object:Gem::Requirement
108
108
  requirements:
109
109
  - - ">="
@@ -131,7 +131,7 @@ dependencies:
131
131
  - !ruby/object:Gem::Version
132
132
  version: '0'
133
133
  - !ruby/object:Gem::Dependency
134
- name: database_cleaner
134
+ name: sqlite3
135
135
  requirement: !ruby/object:Gem::Requirement
136
136
  requirements:
137
137
  - - ">="
@@ -175,9 +175,9 @@ files:
175
175
  - README.md
176
176
  - Rakefile
177
177
  - acts_as_archival.gemspec
178
- - gemfiles/rails_3.gemfile
179
178
  - gemfiles/rails_4.1.gemfile
180
- - gemfiles/rails_4.gemfile
179
+ - gemfiles/rails_4.2.gemfile
180
+ - gemfiles/rails_5.0.gemfile
181
181
  - init.rb
182
182
  - lib/acts_as_archival.rb
183
183
  - lib/acts_as_archival/version.rb
@@ -189,15 +189,21 @@ files:
189
189
  - script/db_setup
190
190
  - script/setup
191
191
  - test/ambiguous_table_test.rb
192
+ - test/application_record_test.rb
192
193
  - test/associations_test.rb
193
194
  - test/basic_test.rb
195
+ - test/callbacks_test.rb
194
196
  - test/column_test.rb
195
197
  - test/database.yml
196
198
  - test/deep_nesting_test.rb
199
+ - test/fixtures/application_record.rb
200
+ - test/fixtures/application_record_row.rb
197
201
  - test/fixtures/archival.rb
198
202
  - test/fixtures/archival_grandkid.rb
199
203
  - test/fixtures/archival_kid.rb
200
204
  - test/fixtures/archival_table_name.rb
205
+ - test/fixtures/callback_archival_4.rb
206
+ - test/fixtures/callback_archival_5.rb
201
207
  - test/fixtures/exploder.rb
202
208
  - test/fixtures/independent_archival.rb
203
209
  - test/fixtures/mass_attribute_protected.rb
@@ -244,15 +250,21 @@ specification_version: 4
244
250
  summary: Atomic archiving/unarchiving for ActiveRecord-based apps
245
251
  test_files:
246
252
  - test/ambiguous_table_test.rb
253
+ - test/application_record_test.rb
247
254
  - test/associations_test.rb
248
255
  - test/basic_test.rb
256
+ - test/callbacks_test.rb
249
257
  - test/column_test.rb
250
258
  - test/database.yml
251
259
  - test/deep_nesting_test.rb
260
+ - test/fixtures/application_record.rb
261
+ - test/fixtures/application_record_row.rb
252
262
  - test/fixtures/archival.rb
253
263
  - test/fixtures/archival_grandkid.rb
254
264
  - test/fixtures/archival_kid.rb
255
265
  - test/fixtures/archival_table_name.rb
266
+ - test/fixtures/callback_archival_4.rb
267
+ - test/fixtures/callback_archival_5.rb
256
268
  - test/fixtures/exploder.rb
257
269
  - test/fixtures/independent_archival.rb
258
270
  - test/fixtures/mass_attribute_protected.rb