class JSONAPI::Resources::Matchers::HaveCreatableField
Attributes
name[RW]
resource[RW]
Public Class Methods
new(name)
click to toggle source
# File lib/jsonapi/resources/matchers/have_creatable_field.rb, line 8 def initialize(name) self.name = name end
Public Instance Methods
description()
click to toggle source
# File lib/jsonapi/resources/matchers/have_creatable_field.rb, line 27 def description "have creatable field `#{name}`" end
failure_message()
click to toggle source
# File lib/jsonapi/resources/matchers/have_creatable_field.rb, line 17 def failure_message resource_name = resource.class.name.demodulize %Q(expected #{resource_name} to have creatable field `#{name}`) end
failure_message_when_negated()
click to toggle source
# File lib/jsonapi/resources/matchers/have_creatable_field.rb, line 22 def failure_message_when_negated resource_name = resource.class.name.demodulize %Q(expected #{resource_name} not to have creatable field `#{name}`) end
matches?(resource)
click to toggle source
# File lib/jsonapi/resources/matchers/have_creatable_field.rb, line 12 def matches?(resource) self.resource = resource resource.class.creatable_fields(resource.context).include?(name) end