acts_as_archival 2.0.0 → 2.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
  SHA256:
3
- metadata.gz: 1f9de47af7c26b8d78744f6f150523da886cc3e72f3adfdf2c43489f92dd29d7
4
- data.tar.gz: eb8710dc7dd90dfb876b83e61f9d08ac01003d734950f9554abd24d91e428875
3
+ metadata.gz: ebfd9690765e2b7676db8c90e2459ccccf3ff2ef9f6b94898fafa565cfdc708a
4
+ data.tar.gz: 303ee5fb63bd23c6bc35ef69b23eab80c455acd75632e3ca41a03b378fb3a471
5
5
  SHA512:
6
- metadata.gz: e16b3e95c07251f5f5c1dcd2b960e76ffc3f41241c7601b9cb7923e1f89bbc3c4aa21be46ad2b55ebce502933a3d6171ed1a57874857001a653db984822d8176
7
- data.tar.gz: 9b818f82e6072dde8e0f7e1a621dd7593b918cb696738a0b1750b2357ab732250e18ae5d008813f3b8dc8204447df0f37e98561532343105c89682cd46a9a3c8
6
+ metadata.gz: d559c3b334d403418304225720db0b4cc78517bc4fd7fd43d6e3cb0bae8704c7f7e05288202658bec3d1622395e76583d538dca5ba942fbb4108a77060e19988
7
+ data.tar.gz: 1e64b71d7f09a82d38e68abb807c36a70f7ce6fe577ec45047a1f1cfb6cf466280634fae78acfb4c83f9b81a9a801a68c79095cd2f5102dc7e28ab9cf6eb1716
data/.gitignore CHANGED
@@ -8,3 +8,4 @@ gemfiles/*.lock
8
8
  pkg/*
9
9
  .DS_Store
10
10
  *.sqlite3
11
+ .idea/
data/.rubocop.yml CHANGED
@@ -4,8 +4,9 @@ AllCops:
4
4
  Exclude:
5
5
  - vendor/**/*
6
6
  - gemfiles/**/*
7
- TargetRubyVersion: 2.4
7
+ MinimumTargetRubyVersion: 2.7.3
8
8
  NewCops: enable
9
+ SuggestExtensions: false
9
10
 
10
11
 
11
12
  ################
data/Appraisals CHANGED
@@ -1,12 +1,7 @@
1
- appraise "rails-5.2" do
2
- gem "rails", "~> 5.2.0"
3
- gem "sqlite3", "~> 1.4.1"
4
- end
5
-
6
- appraise "rails-6.0" do
7
- gem "rails", "~> 6.0.0"
8
- end
9
-
10
1
  appraise "rails-6.1" do
11
2
  gem "rails", "~> 6.1"
12
3
  end
4
+
5
+ appraise "rails-7.0" do
6
+ gem "rails", "~> 7.0"
7
+ end
data/CHANGELOG.md CHANGED
@@ -1,6 +1,12 @@
1
1
  # CHANGELOG
2
2
 
3
- ## 2.0.0 – (UNRELEASED)
3
+ ## 2.1.0
4
+ * **BREAKING CHANGE** Drop support for Rails 5.2 and 6.0 (6.1 support remains)
5
+ * Add support for Rails 7
6
+ * Fix deprecation warnings
7
+ * Need Ruby >=2.7 for Rails 7 support
8
+
9
+ ## 2.0.0
4
10
 
5
11
  * **BREAKING CHANGE** Drop support for Rails 4.2
6
12
  * **BREAKING CHANGE** Drop support for Rails 5.0
data/Gemfile.lock CHANGED
@@ -1,57 +1,58 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- acts_as_archival (2.0.0)
5
- activerecord (>= 5.0)
4
+ acts_as_archival (2.1.0)
5
+ activerecord (>= 6.1)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- activemodel (6.1.4.1)
11
- activesupport (= 6.1.4.1)
12
- activerecord (6.1.4.1)
13
- activemodel (= 6.1.4.1)
14
- activesupport (= 6.1.4.1)
15
- activesupport (6.1.4.1)
10
+ activemodel (7.0.3)
11
+ activesupport (= 7.0.3)
12
+ activerecord (7.0.3)
13
+ activemodel (= 7.0.3)
14
+ activesupport (= 7.0.3)
15
+ activesupport (7.0.3)
16
16
  concurrent-ruby (~> 1.0, >= 1.0.2)
17
17
  i18n (>= 1.6, < 2)
18
18
  minitest (>= 5.1)
19
19
  tzinfo (~> 2.0)
20
- zeitwerk (~> 2.3)
21
20
  appraisal (2.2.0)
22
21
  bundler
23
22
  rake
24
23
  thor (>= 0.14.0)
25
24
  assertions-eb (1.7.3)
26
- ast (2.4.0)
27
- concurrent-ruby (1.1.9)
25
+ ast (2.4.2)
26
+ concurrent-ruby (1.1.10)
28
27
  database_cleaner (1.8.4)
29
- i18n (1.8.10)
28
+ i18n (1.10.0)
30
29
  concurrent-ruby (~> 1.0)
31
- jaro_winkler (1.5.4)
32
- minitest (5.14.4)
33
- parallel (1.19.1)
34
- parser (2.7.1.1)
35
- ast (~> 2.4.0)
36
- rainbow (3.0.0)
30
+ minitest (5.16.1)
31
+ parallel (1.22.1)
32
+ parser (3.1.2.0)
33
+ ast (~> 2.4.1)
34
+ rainbow (3.1.1)
37
35
  rake (13.0.1)
38
- rexml (3.2.4)
36
+ regexp_parser (2.5.0)
37
+ rexml (3.2.5)
39
38
  rr (1.2.1)
40
- rubocop (0.82.0)
41
- jaro_winkler (~> 1.5.1)
39
+ rubocop (1.30.1)
42
40
  parallel (~> 1.10)
43
- parser (>= 2.7.0.1)
41
+ parser (>= 3.1.0.0)
44
42
  rainbow (>= 2.2.2, < 4.0)
45
- rexml
43
+ regexp_parser (>= 1.8, < 3.0)
44
+ rexml (>= 3.2.5, < 4.0)
45
+ rubocop-ast (>= 1.18.0, < 2.0)
46
46
  ruby-progressbar (~> 1.7)
47
- unicode-display_width (>= 1.4.0, < 2.0)
48
- ruby-progressbar (1.10.1)
47
+ unicode-display_width (>= 1.4.0, < 3.0)
48
+ rubocop-ast (1.18.0)
49
+ parser (>= 3.1.1.0)
50
+ ruby-progressbar (1.11.0)
49
51
  sqlite3 (1.4.2)
50
52
  thor (1.0.1)
51
53
  tzinfo (2.0.4)
52
54
  concurrent-ruby (~> 1.0)
53
- unicode-display_width (1.7.0)
54
- zeitwerk (2.4.2)
55
+ unicode-display_width (2.1.0)
55
56
 
56
57
  PLATFORMS
57
58
  ruby
@@ -63,7 +64,7 @@ DEPENDENCIES
63
64
  database_cleaner
64
65
  rake
65
66
  rr
66
- rubocop (~> 0.82.0)
67
+ rubocop (~> 1.30.1)
67
68
  sqlite3
68
69
 
69
70
  BUNDLED WITH
@@ -5,6 +5,7 @@ require "acts_as_archival/version"
5
5
  Gem::Specification.new do |gem|
6
6
  gem.name = "acts_as_archival"
7
7
  gem.summary = "Atomic archiving/unarchiving for ActiveRecord-based apps"
8
+ gem.licenses = ['MIT']
8
9
  gem.version = ActsAsArchival::VERSION
9
10
  gem.authors = ["Joel Meador",
10
11
  "Michael Kuehl",
@@ -26,19 +27,20 @@ Gem::Specification.new do |gem|
26
27
  "nathan@expectedbehavior.com"]
27
28
  gem.homepage = "http://github.com/expectedbehavior/acts_as_archival"
28
29
 
30
+ gem.metadata["rubygems_mfa_required"] = "true"
31
+
29
32
  gem.files = `git ls-files`.split("\n")
30
- gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
31
33
  gem.require_paths = ["lib"]
32
- gem.required_ruby_version = ">= 2.4"
34
+ gem.required_ruby_version = ">= 2.7.3"
33
35
 
34
- gem.add_dependency "activerecord", ">= 5.0"
36
+ gem.add_dependency "activerecord", ">= 6.1"
35
37
 
36
38
  gem.add_development_dependency "appraisal"
37
39
  gem.add_development_dependency "assertions-eb"
38
40
  gem.add_development_dependency "database_cleaner"
39
41
  gem.add_development_dependency "rake"
40
42
  gem.add_development_dependency "rr"
41
- gem.add_development_dependency "rubocop", "~> 0.82.0"
43
+ gem.add_development_dependency "rubocop", "~> 1.30.1"
42
44
  gem.add_development_dependency "sqlite3"
43
45
 
44
46
  gem.description =
@@ -2,6 +2,6 @@
2
2
 
3
3
  source "https://rubygems.org"
4
4
 
5
- gem "rails", "~> 6.0.0"
5
+ gem "rails", "~> 7.0"
6
6
 
7
7
  gemspec path: "../"
@@ -1,5 +1,5 @@
1
1
  module ActsAsArchival
2
2
 
3
- VERSION = "2.0.0".freeze
3
+ VERSION = "2.1.0".freeze
4
4
 
5
5
  end
@@ -3,13 +3,13 @@ module ExpectedBehavior
3
3
 
4
4
  require "digest/md5"
5
5
 
6
- unless defined?(MissingArchivalColumnError) == "constant" && MissingArchivalColumnError.class == Class
6
+ unless defined?(MissingArchivalColumnError) == "constant" && MissingArchivalColumnError.instance_of?(Class)
7
7
  MissingArchivalColumnError = Class.new(ActiveRecord::ActiveRecordError)
8
8
  end
9
- unless defined?(CouldNotArchiveError) == "constant" && CouldNotArchiveError.class == Class
9
+ unless defined?(CouldNotArchiveError) == "constant" && CouldNotArchiveError.instance_of?(Class)
10
10
  CouldNotArchiveError = Class.new(ActiveRecord::ActiveRecordError)
11
11
  end
12
- unless defined?(CouldNotUnarchiveError) == "constant" && CouldNotUnarchiveError.class == Class
12
+ unless defined?(CouldNotUnarchiveError) == "constant" && CouldNotUnarchiveError.instance_of?(Class)
13
13
  CouldNotUnarchiveError = Class.new(ActiveRecord::ActiveRecordError)
14
14
  end
15
15
 
@@ -66,6 +66,7 @@ module ExpectedBehavior
66
66
 
67
67
  private def define_callback_dsl_method(callbackable_type, action)
68
68
  # rubocop:disable Security/Eval
69
+ # rubocop:disable Style/DocumentDynamicEvalDefinition
69
70
  eval <<-end_callbacks
70
71
  unless defined?(#{callbackable_type}_#{action})
71
72
  def #{callbackable_type}_#{action}(*args, &blk)
@@ -73,6 +74,7 @@ module ExpectedBehavior
73
74
  end
74
75
  end
75
76
  end_callbacks
77
+ # rubocop:enable Style/DocumentDynamicEvalDefinition
76
78
  # rubocop:enable Security/Eval
77
79
  end
78
80
 
@@ -132,16 +134,15 @@ module ExpectedBehavior
132
134
  AssociationOperation::Unarchive.new(self, head_archive_number).execute
133
135
  end
134
136
 
135
- private def execute_archival_action(action)
137
+ private def execute_archival_action(action, &block)
138
+ result = false
136
139
  self.class.transaction do
137
- begin
138
- success = run_callbacks(action) { yield }
139
- return !!success
140
- rescue => e
141
- handle_archival_action_exception(e)
142
- end
140
+ result = !!run_callbacks(action, &block)
141
+ rescue => e
142
+ handle_archival_action_exception(e)
143
143
  end
144
- false
144
+
145
+ result
145
146
  end
146
147
 
147
148
  private def handle_archival_action_exception(exception)
@@ -2,40 +2,21 @@ require_relative "test_helper"
2
2
 
3
3
  class CallbacksTest < ActiveSupport::TestCase
4
4
 
5
- if defined?(ApplicationRecord)
6
- test "can set a value as part of archiving" do
7
- archival = CallbackArchival5.create
8
- archival.set_this_value = "a test string"
9
- assert_nil archival.settable_field
10
- archival.archive!
11
- assert_equal "a test string", archival.reload.settable_field
12
- end
13
-
14
- test "can be halted" do
15
- archival = CallbackArchival5.create
16
- archival.set_this_value = "a test string"
17
- archival.pass_callback = false
18
- assert_nil archival.settable_field
19
- archival.archive!
20
- assert_nil archival.reload.settable_field
21
- end
22
- else
23
- test "can set a value as part of archiving" do
24
- archival = CallbackArchival4.create
25
- archival.set_this_value = "a test string"
26
- assert_nil archival.settable_field
27
- archival.archive!
28
- assert_equal "a test string", archival.reload.settable_field
29
- end
5
+ test "can set a value as part of archiving" do
6
+ archival = CallbackArchival.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
30
12
 
31
- test "can be halted" do
32
- archival = CallbackArchival4.create
33
- archival.set_this_value = "a test string"
34
- archival.pass_callback = false
35
- assert_nil archival.settable_field
36
- archival.archive!
37
- assert_nil archival.reload.settable_field
38
- end
13
+ test "can be halted" do
14
+ archival = CallbackArchival.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
39
20
  end
40
21
 
41
22
  end
@@ -1,4 +1,4 @@
1
- class CallbackArchival4 < ActiveRecord::Base
1
+ class CallbackArchival < ApplicationRecord
2
2
 
3
3
  acts_as_archival
4
4
 
@@ -8,12 +8,15 @@ class CallbackArchival4 < ActiveRecord::Base
8
8
  before_archive :set_value,
9
9
  :conditional_callback_passer
10
10
 
11
- private def set_value
11
+ private
12
+
13
+ def set_value
12
14
  self.settable_field = set_this_value
13
15
  end
14
16
 
15
- private def conditional_callback_passer
16
- pass_callback || pass_callback.nil?
17
+ def conditional_callback_passer
18
+ # we want to throw only for the value false
19
+ throw(:abort) unless pass_callback || pass_callback.nil?
17
20
  end
18
21
 
19
22
  end
data/test/schema.rb CHANGED
@@ -76,13 +76,7 @@ ActiveRecord::Schema.define(version: 1) do
76
76
  t.column :archived_at, :datetime
77
77
  end
78
78
 
79
- create_table :callback_archival4s, force: true do |t|
80
- t.column :settable_field, :string
81
- t.column :archive_number, :string
82
- t.column :archived_at, :datetime
83
- end
84
-
85
- create_table :callback_archival5s, force: true do |t|
79
+ create_table :callback_archivals, force: true do |t|
86
80
  t.column :settable_field, :string
87
81
  t.column :archive_number, :string
88
82
  t.column :archived_at, :datetime
data/test/scope_test.rb CHANGED
@@ -52,15 +52,11 @@ class ScopeTest < ActiveSupport::TestCase
52
52
 
53
53
  test "table_name is set to 'legacy'" do
54
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
55
+ "SELECT \"legacy\".* FROM \"legacy\" " \
56
+ 'WHERE "legacy"."archived_at" IS NOT NULL AND "legacy"."archive_number" IS NOT NULL'
57
+
62
58
  unarchived_sql = "SELECT \"legacy\".* FROM \"legacy\" " \
63
- 'WHERE "legacy"."archived_at" IS NULL AND "legacy"."archive_number" IS NULL'
59
+ 'WHERE "legacy"."archived_at" IS NULL AND "legacy"."archive_number" IS NULL'
64
60
  assert_equal archived_sql, ArchivalTableName.archived.to_sql
65
61
  assert_equal unarchived_sql, ArchivalTableName.unarchived.to_sql
66
62
  end
data/test/test_helper.rb CHANGED
@@ -1,4 +1,4 @@
1
- $LOAD_PATH.unshift(File.dirname(__FILE__) + "/../lib")
1
+ $LOAD_PATH.unshift("#{File.dirname(__FILE__)}/../lib")
2
2
  require "bundler/setup"
3
3
  require "minitest/autorun"
4
4
  require "minitest/pride"
@@ -22,7 +22,7 @@ end
22
22
 
23
23
  def setup_logging
24
24
  require "logger"
25
- logfile = File.dirname(__FILE__) + "/debug.log"
25
+ logfile = "#{File.dirname(__FILE__)}/debug.log"
26
26
  ActiveRecord::Base.logger = Logger.new(logfile)
27
27
  end
28
28
 
@@ -43,7 +43,7 @@ def sqlite_config
43
43
  end
44
44
 
45
45
  def create_test_tables
46
- schema_file = File.dirname(__FILE__) + "/schema.rb"
46
+ schema_file = "#{File.dirname(__FILE__)}/schema.rb"
47
47
  puts "** Loading schema for SQLite"
48
48
  ActiveRecord::Base.establish_connection(sqlite_config)
49
49
  load(schema_file) if File.exist?(schema_file)
@@ -61,17 +61,10 @@ BASE_FIXTURE_CLASSES = [
61
61
  :missing_archive_number,
62
62
  :plain,
63
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 = [
64
+ :readonly_when_archived,
72
65
  :application_record,
73
66
  :application_record_row,
74
- :callback_archival_5
67
+ :callback_archival
75
68
  ].freeze
76
69
 
77
70
  def require_test_classes
@@ -79,14 +72,9 @@ def require_test_classes
79
72
  inflect.irregular "poly", "polys"
80
73
  end
81
74
 
82
- fixtures = if ActiveRecord::VERSION::MAJOR >= 4
83
- RAILS_5_FIXTURE_CLASSES
84
- else
85
- RAILS_4_FIXTURE_CLASSES
86
- end
87
-
88
- fixtures += BASE_FIXTURE_CLASSES
89
- fixtures.each { |test_class_file| require_relative "fixtures/#{test_class_file}" }
75
+ BASE_FIXTURE_CLASSES.each do |test_class_file|
76
+ require_relative "fixtures/#{test_class_file}"
77
+ end
90
78
  end
91
79
 
92
80
  prepare_for_tests
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: 2.0.0
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joel Meador
@@ -21,7 +21,7 @@ authors:
21
21
  autorequire:
22
22
  bindir: bin
23
23
  cert_chain: []
24
- date: 2021-10-19 00:00:00.000000000 Z
24
+ date: 2022-06-21 00:00:00.000000000 Z
25
25
  dependencies:
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: activerecord
@@ -29,14 +29,14 @@ dependencies:
29
29
  requirements:
30
30
  - - ">="
31
31
  - !ruby/object:Gem::Version
32
- version: '5.0'
32
+ version: '6.1'
33
33
  type: :runtime
34
34
  prerelease: false
35
35
  version_requirements: !ruby/object:Gem::Requirement
36
36
  requirements:
37
37
  - - ">="
38
38
  - !ruby/object:Gem::Version
39
- version: '5.0'
39
+ version: '6.1'
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: appraisal
42
42
  requirement: !ruby/object:Gem::Requirement
@@ -113,14 +113,14 @@ dependencies:
113
113
  requirements:
114
114
  - - "~>"
115
115
  - !ruby/object:Gem::Version
116
- version: 0.82.0
116
+ version: 1.30.1
117
117
  type: :development
118
118
  prerelease: false
119
119
  version_requirements: !ruby/object:Gem::Requirement
120
120
  requirements:
121
121
  - - "~>"
122
122
  - !ruby/object:Gem::Version
123
- version: 0.82.0
123
+ version: 1.30.1
124
124
  - !ruby/object:Gem::Dependency
125
125
  name: sqlite3
126
126
  requirement: !ruby/object:Gem::Requirement
@@ -170,9 +170,8 @@ files:
170
170
  - README.md
171
171
  - Rakefile
172
172
  - acts_as_archival.gemspec
173
- - gemfiles/rails_5.2.gemfile
174
- - gemfiles/rails_6.0.gemfile
175
173
  - gemfiles/rails_6.1.gemfile
174
+ - gemfiles/rails_7.0.gemfile
176
175
  - init.rb
177
176
  - lib/acts_as_archival.rb
178
177
  - lib/acts_as_archival/version.rb
@@ -196,8 +195,7 @@ files:
196
195
  - test/fixtures/archival_grandkid.rb
197
196
  - test/fixtures/archival_kid.rb
198
197
  - test/fixtures/archival_table_name.rb
199
- - test/fixtures/callback_archival_4.rb
200
- - test/fixtures/callback_archival_5.rb
198
+ - test/fixtures/callback_archival.rb
201
199
  - test/fixtures/exploder.rb
202
200
  - test/fixtures/independent_archival.rb
203
201
  - test/fixtures/missing_archive_number.rb
@@ -215,8 +213,10 @@ files:
215
213
  - test/through_association_test.rb
216
214
  - test/transaction_test.rb
217
215
  homepage: http://github.com/expectedbehavior/acts_as_archival
218
- licenses: []
219
- metadata: {}
216
+ licenses:
217
+ - MIT
218
+ metadata:
219
+ rubygems_mfa_required: 'true'
220
220
  post_install_message:
221
221
  rdoc_options: []
222
222
  require_paths:
@@ -225,47 +225,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
225
225
  requirements:
226
226
  - - ">="
227
227
  - !ruby/object:Gem::Version
228
- version: '2.4'
228
+ version: 2.7.3
229
229
  required_rubygems_version: !ruby/object:Gem::Requirement
230
230
  requirements:
231
231
  - - ">="
232
232
  - !ruby/object:Gem::Version
233
233
  version: '0'
234
234
  requirements: []
235
- rubygems_version: 3.1.2
235
+ rubygems_version: 3.3.3
236
236
  signing_key:
237
237
  specification_version: 4
238
238
  summary: Atomic archiving/unarchiving for ActiveRecord-based apps
239
- test_files:
240
- - test/ambiguous_table_test.rb
241
- - test/application_record_test.rb
242
- - test/associations_test.rb
243
- - test/basic_test.rb
244
- - test/callbacks_test.rb
245
- - test/column_test.rb
246
- - test/deep_nesting_test.rb
247
- - test/fixtures/another_polys_holder.rb
248
- - test/fixtures/application_record.rb
249
- - test/fixtures/application_record_row.rb
250
- - test/fixtures/archival.rb
251
- - test/fixtures/archival_grandkid.rb
252
- - test/fixtures/archival_kid.rb
253
- - test/fixtures/archival_table_name.rb
254
- - test/fixtures/callback_archival_4.rb
255
- - test/fixtures/callback_archival_5.rb
256
- - test/fixtures/exploder.rb
257
- - test/fixtures/independent_archival.rb
258
- - test/fixtures/missing_archive_number.rb
259
- - test/fixtures/missing_archived_at.rb
260
- - test/fixtures/plain.rb
261
- - test/fixtures/poly.rb
262
- - test/fixtures/readonly_when_archived.rb
263
- - test/polymorphic_test.rb
264
- - test/readonly_when_archived_test.rb
265
- - test/relations_test.rb
266
- - test/responds_test.rb
267
- - test/schema.rb
268
- - test/scope_test.rb
269
- - test/test_helper.rb
270
- - test/through_association_test.rb
271
- - test/transaction_test.rb
239
+ test_files: []
@@ -1,8 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "rails", "~> 5.2.0"
6
- gem "sqlite3", "~> 1.4.1"
7
-
8
- gemspec path: "../"
@@ -1,23 +0,0 @@
1
- # necessary for ApplicationRecord
2
- if defined?(ApplicationRecord)
3
- class CallbackArchival5 < ApplicationRecord
4
-
5
- acts_as_archival
6
-
7
- attr_accessor :set_this_value,
8
- :pass_callback
9
-
10
- before_archive :set_value,
11
- :conditional_callback_passer
12
-
13
- private def set_value
14
- self.settable_field = set_this_value
15
- end
16
-
17
- private def conditional_callback_passer
18
- # we want to throw only for the value false
19
- throw(:abort) unless pass_callback || pass_callback.nil?
20
- end
21
-
22
- end
23
- end