Sha256: 3f2c488a0c5c71dbd74bc77de1100da0bdd7038fddba5a69fcc16ee6129c2ad8
Contents?: true
Size: 707 Bytes
Versions: 2
Compression:
Stored size: 707 Bytes
Contents
require 'test_helper' require 'roar/decorator' class CollectionRepresenterTest < MiniTest::Spec class SongRepresenter < Roar::Decorator include Roar::JSON property :name end class SongsRepresenter < Roar::Decorator include Roar::JSON include Roar::Contrib::Decorator::CollectionRepresenter end let(:songs) do [ OpenStruct.new(:name => 'Thriller'), OpenStruct.new(:name => 'One More Time'), OpenStruct.new(:name => 'Good Vibrations') ] end it 'renders a valid collection' do SongsRepresenter .prepare(songs) .to_json .must_equal '{"songs":[{"name":"Thriller"},{"name":"One More Time"},{"name":"Good Vibrations"}]}' end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
roar-contrib-0.0.1 | test/decorator/collection_representer_test.rb |
roar-contrib-0.0.1.alpha1 | test/decorator/collection_representer_test.rb |