Sha256: 456662e9857186bf55d68538d2508e6376af2d5d2ba483284b108920ce8b7efa
Contents?: true
Size: 907 Bytes
Versions: 3
Compression:
Stored size: 907 Bytes
Contents
require 'spec_helper' describe 'attributes' do it 'pulls attributes off associated model' do post = Post.new(name: 'Samwise', body: 'Hobbit extraordinaire.') serializer = PostCsverizer.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 = Post2Csverizer.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 = Post3Csverizer.new(post) csv = serializer.to_csv expect(csv).to include(post.name) expect(csv).to include(post.body) end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
csverizer-0.0.7 | spec/active_model/attributes_spec.rb |
csverizer-0.0.6 | spec/active_model/attributes_spec.rb |
csverizer-0.0.5 | spec/active_model/attributes_spec.rb |