Skip to content

Commit 7bb6977

Browse files
committed
Ignoring deprecation related methods from test coverage report
1 parent b881ed6 commit 7bb6977

3 files changed

Lines changed: 14 additions & 5 deletions

File tree

lib/jsonapi/request.rb

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -316,14 +316,18 @@ def add_show_related_resources_operation(association_type)
316316
)
317317
end
318318

319-
def parse_add_operation(data)
320-
# TODO: Please remove the deprecation warning and clean up the code
319+
# TODO: Please remove after `createabel_fields` is removed
320+
# :nocov:
321+
def creatable_fields
321322
if @resource_klass.respond_to?(:createable_fields)
322323
creatable_fields = @resource_klass.createable_fields(@context)
323324
else
324325
creatable_fields = @resource_klass.creatable_fields(@context)
325326
end
327+
end
328+
# :nocov:
326329

330+
def parse_add_operation(data)
327331
Array.wrap(data).each do |params|
328332
verify_type(params[:type])
329333

@@ -493,14 +497,16 @@ def verify_permitted_params(params, allowed_fields)
493497
raise JSONAPI::Exceptions::ParametersNotAllowed.new(params_not_allowed) if params_not_allowed.length > 0
494498
end
495499

496-
# TODO: Remove after the 'updateable_fields' deprecation expired
500+
# TODO: Please remove after `updateable_fields` is removed
501+
# :nocov:
497502
def updatable_fields
498503
if @resource_klass.respond_to?(:updateable_fields)
499504
@resource_klass.updateable_fields(@context)
500505
else
501506
@resource_klass.updatable_fields(@context)
502507
end
503508
end
509+
# :nocov:
504510

505511
def parse_add_association_operation(data, association_type, parent_key)
506512
association = resource_klass._association(association_type)

lib/jsonapi/resource.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,8 @@ def primary_key(key)
287287
@_primary_key = key.to_sym
288288
end
289289

290+
# TODO: remove this after the createable_fields and updateable_fields are phased out
291+
# :nocov:
290292
def method_missing(method, *args)
291293
if method.to_s.match /createable_fields/
292294
ActiveSupport::Deprecation.warn("`createable_fields` is deprecated, please use `creatable_fields` instead")
@@ -298,6 +300,7 @@ def method_missing(method, *args)
298300
super
299301
end
300302
end
303+
# :nocov:
301304

302305
# Override in your resource to filter the updatable keys
303306
def updatable_fields(context = nil)

test/unit/resource/resource_test.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,14 +136,14 @@ def test_updatable_fields_does_not_include_id
136136
assert(!CatResource.updatable_fields.include?(:id))
137137
end
138138

139-
# TODO: Please remove this test after the updateable_fields method is removed
139+
# TODO: Please remove after `updateable_fields` is removed
140140
def test_updateable_fields_delegates_to_updatable_fields_with_deprecation
141141
ActiveSupport::Deprecation.silence do
142142
assert_empty(CatResource.updateable_fields(nil) - [:mother, :father, :name, :breed])
143143
end
144144
end
145145

146-
# TODO: Please remove this test after the createable_fields method is removed
146+
# TODO: Please remove after `createable_fields` is removed
147147
def test_createable_fields_delegates_to_creatable_fields_with_deprecation
148148
ActiveSupport::Deprecation.silence do
149149
assert_empty(CatResource.createable_fields(nil) - [:mother, :father, :name, :breed, :id])

0 commit comments

Comments
 (0)