Sha256: 82d1cd106101dc13d9ff71c80848449cc864ca9fda15c618855645aa21411c4c
Contents?: true
Size: 1.12 KB
Versions: 3
Compression:
Stored size: 1.12 KB
Contents
require_relative '../test_helper' require 'hyperclient/resource' module Hyperclient describe Collection do let(:representation) do JSON.parse( File.read('test/fixtures/element.json')) end let(:collection) do Collection.new(representation) end it 'exposes the collection as methods' do collection.title.must_equal 'Real World ASP.NET MVC3' collection.description.must_match(/production/) collection.permitted.must_equal true end it 'exposes collection as a hash' do collection['title'].must_equal 'Real World ASP.NET MVC3' collection['description'].must_match(/production/) collection['permitted'].must_equal true end it 'correctly responds to methods' do collection.must_respond_to :title end it 'acts as enumerable' do names = collection.map do |name, value| name end names.must_equal ['_links', 'title', 'description', 'permitted', '_embedded'] end describe '#to_hash' do it 'returns the wrapped collection as a hash' do collection.to_hash.must_be_kind_of Hash end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
hyperclient-0.3.1 | test/hyperclient/collection_test.rb |
hyperclient-0.3.0 | test/hyperclient/collection_test.rb |
hyperclient-0.2.0 | test/hyperclient/collection_test.rb |