summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJasper Maes <jaspermaes.jm@gmail.com>2019-01-03 19:26:13 +0100
committerJasper Maes <jaspermaes.jm@gmail.com>2019-01-11 19:28:38 +0100
commit16c1c0b184dad17df6d36562ac851df204e8a214 (patch)
treeb1a68531676852dd39493c8b6e2346673b2a5f1b
parentfe4f8cad21155c53aaf07a137d27bec9039a6379 (diff)
downloadgitlab-ce-16c1c0b184dad17df6d36562ac851df204e8a214.tar.gz
Fix deprecation: Passing an argument to force an association to reload is now deprecated
-rw-r--r--app/models/concerns/manual_inverse_association.rb4
-rw-r--r--changelogs/unreleased/deprecated-force-reload.yml6
-rw-r--r--spec/models/concerns/manual_inverse_association_spec.rb4
-rw-r--r--spec/models/gpg_key_spec.rb2
-rw-r--r--spec/services/ci/process_pipeline_service_spec.rb2
5 files changed, 12 insertions, 6 deletions
diff --git a/app/models/concerns/manual_inverse_association.rb b/app/models/concerns/manual_inverse_association.rb
index e18edd33ba7..ff61412767e 100644
--- a/app/models/concerns/manual_inverse_association.rb
+++ b/app/models/concerns/manual_inverse_association.rb
@@ -5,8 +5,8 @@ module ManualInverseAssociation
class_methods do
def manual_inverse_association(association, inverse)
- define_method(association) do |*args|
- super(*args).tap do |value|
+ define_method(association) do
+ super().tap do |value|
next unless value
child_association = value.association(inverse)
diff --git a/changelogs/unreleased/deprecated-force-reload.yml b/changelogs/unreleased/deprecated-force-reload.yml
new file mode 100644
index 00000000000..2a0e97089e0
--- /dev/null
+++ b/changelogs/unreleased/deprecated-force-reload.yml
@@ -0,0 +1,6 @@
+---
+title: 'Fix deprecation: Passing an argument to force an association to reload is
+ now deprecated'
+merge_request: 24136
+author: Jasper Maes
+type: other
diff --git a/spec/models/concerns/manual_inverse_association_spec.rb b/spec/models/concerns/manual_inverse_association_spec.rb
index aad40883854..ff4a04ea573 100644
--- a/spec/models/concerns/manual_inverse_association_spec.rb
+++ b/spec/models/concerns/manual_inverse_association_spec.rb
@@ -32,10 +32,10 @@ describe ManualInverseAssociation do
.not_to exceed_query_limit(0)
end
- it 'passes arguments to the default association method, to allow reloading' do
+ it 'allows reloading the relation' do
query_count = ActiveRecord::QueryRecorder.new do
instance.manual_association
- instance.manual_association(true)
+ instance.reload_manual_association
end.count
expect(query_count).to eq(2)
diff --git a/spec/models/gpg_key_spec.rb b/spec/models/gpg_key_spec.rb
index 33e6f1de3d1..58a1d2e4ea2 100644
--- a/spec/models/gpg_key_spec.rb
+++ b/spec/models/gpg_key_spec.rb
@@ -199,7 +199,7 @@ describe GpgKey do
gpg_key.revoke
- expect(gpg_key.subkeys(true)).to be_blank
+ expect(gpg_key.subkeys.reload).to be_blank
end
it 'invalidates all signatures associated to the subkeys' do
diff --git a/spec/services/ci/process_pipeline_service_spec.rb b/spec/services/ci/process_pipeline_service_spec.rb
index 7ce7d2d882a..6674d89518e 100644
--- a/spec/services/ci/process_pipeline_service_spec.rb
+++ b/spec/services/ci/process_pipeline_service_spec.rb
@@ -762,7 +762,7 @@ describe Ci::ProcessPipelineService, '#execute' do
end
def manual_actions
- pipeline.manual_actions(true)
+ pipeline.manual_actions.reload
end
def create_build(name, **opts)