Sha256: 31e964b6d87c62aaa9179a07bbfa25a679b6b2ba42b30b18b99e7da8492a8951
Contents?: true
Size: 904 Bytes
Versions: 1
Compression:
Stored size: 904 Bytes
Contents
require 'spec_helper' describe 'attributes' do it 'pulls attributes off associated model' do post = Post.new(name: 'Samwise', body: 'Hobbit extraordinaire.') serializer = PostCsvrizer.new(post) csv = serializer.to_csv expect(csv).to include(post.name) expect(csv).to include(post.body) end it 'favors methods defined on serializer' do post = Post.new(name: 'Samwise', body: 'Hobbit extraordinaire.') serializer = Post2Csvrizer.new(post) csv = serializer.to_csv expect(csv).to include('pie') expect(csv).to_not include(post.name) expect(csv).to include(post.body) end it 'allows attributes declaration to be split up' do post = Post.new(name: 'Samwise', body: 'Hobbit extraordinaire.') serializer = Post3Csvrizer.new(post) csv = serializer.to_csv expect(csv).to include(post.name) expect(csv).to include(post.body) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
csverizer-0.0.4 | spec/active_model/attributes_spec.rb |