Sha256: b7c1b3d400f41555faeb9a00b0acfdf8967892d4e3f2af1fdcde416ccd628a6e
Contents?: true
Size: 847 Bytes
Versions: 4
Compression:
Stored size: 847 Bytes
Contents
require 'test_helper' require 'roar/json/collection' require 'roar/client' class JsonCollectionTest < MiniTest::Spec class Band < OpenStruct; end class BandRepresenter < Roar::Decorator include Roar::JSON property :name property :label end class BandsRepresenter < Roar::Decorator include Roar::JSON::Collection include Roar::Client items extend: BandRepresenter, class: Band end class Bands < Array include Roar::JSON::Collection end let(:bands) { Bands.new } # "[{\"name\":\"Slayer\",\"label\":\"Canadian Maple\"},{\"name\":\"Nirvana\",\"label\":\"Sub Pop\"}])" it 'fetches lonely collection of existing bands' do BandsRepresenter.new(bands).get(uri: 'http://localhost:4567/bands', as: 'application/json') bands.size.must_equal(2) bands[0].name.must_equal('Slayer') end end
Version data entries
4 entries across 4 versions & 2 rubygems