Skip to content

Instantly share code, notes, and snippets.

@BenMorganIO
Created March 17, 2016 02:18
Show Gist options
  • Select an option

  • Save BenMorganIO/726227bf0d46499af8f5 to your computer and use it in GitHub Desktop.

Select an option

Save BenMorganIO/726227bf0d46499af8f5 to your computer and use it in GitHub Desktop.
Serializer Example - Medium Post
module Medium
class PostSerializer < ApplicationSerializer
attributes :title, :description
end
end
describe Medium::PostSerializer do
let(:post) { build :post }
subject { build_serializer post }
[:post, :description].each do |attribute|
its(:attributes) { should include attribute }
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment