Class: Shaf::Spec::SerializerSpec

Inherits:
Base
  • Object
show all
Includes:
PayloadUtils
Defined in:
lib/shaf/spec/serializer_spec.rb

Constant Summary

Constants inherited from Base

Base::TRANSACTION_OPTIONS

Instance Method Summary collapse

Methods included from PayloadUtils

#assert_attribute, #assert_has_attribute, #assert_has_attributes, #assert_has_embedded, #assert_has_link, #assert_has_links, #assert_header, #assert_link, #assert_status, #attributes, #default_field_value, #each_embedded, #embedded, #embedded_resources, #fill_form, #last_payload, #link_rels, #links, #refute_has_attribute, #refute_has_attributes, #refute_has_embedded, #refute_has_link, #refute_has_links, #set_payload

Methods included from LetBang

included, #let_bangs

Methods included from UriHelper

base_uri, included

Methods included from UriHelperMethods

add_path_helpers, eval_method, path_helpers, #path_helpers, path_helpers_for, register, remove_all

Methods included from Fixtures::Accessors

add, clear, collection

Instance Method Details

#serialize(resource, current_user: nil) ⇒ Object



14
15
16
17
# File 'lib/shaf/spec/serializer_spec.rb', line 14

def serialize(resource, current_user: nil)
  serializer = __serializer || HALPresenter
  set_payload serializer.to_hal(resource, current_user: current_user)
end