title: How to write unit test using rspec for serializer with custom attributes
body: <p>Hi i am working on a RoR project with ruby-2.5.0 and rails 5. I am using the jsonapi-serializers for my api. I have a serializer with custom attribute as follows:-</p>
  
  <pre><code>class ReceiptPartialSerializer
    include JSONAPI::Serializer
  
    TYPE = 'receipt'
    attribute :id
    attribute :receipt_partials
  
    attribute :receipt_partials do
      receipt_container = []
      object.receipt_partials.each do |partial|
        receipt_partial = {}
        receipt_partial['id'] = partial.id
        receipt_partial['image_url'] = 'https:' + partial&amp;.picture&amp;.url
        receipt_container &lt;&lt; receipt_partial
      end
      receipt_container
    end
  end
  </code></pre>
  
  <p>My spec file for this serializer is:-</p>
  
  <pre><code>RSpec.describe ReceiptPartialSerializer do
    let(:id) { 1 }
    let(:image_url) { 'https:/images/original/missing.png' }
    let(:receipt_id) { 1 }
    let(:receipt_partial) do
      ReceiptPartial.new(
        receipt_id: receipt_id
      )
    end
  
    subject { JSONAPI::Serializer.serialize(receipt_partial) }
  
    it { is_expected.to have_jsonapi_attributes('image-url' =&gt; image_url) }
  end
  </code></pre>
  
  <p>But when i run my test it doesnot cover my custom attribute which is receipt_partials. 
  <a href="https://i.stack.imgur.com/ErmRX.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ErmRX.png" alt="enter image description here"></a>
  Any idea how can i cover my custom attribute. Thanks in advance.</p>