Sha256: 85cdf72dc0b4b75cfb4965889baf9d5faa8f806c16c79049cf132afd2385d753
Contents?: true
Size: 767 Bytes
Versions: 23
Compression:
Stored size: 767 Bytes
Contents
require File.dirname(__FILE__) + '/../test_helper.rb' context "active record metadata" do setup do Person.restful_publish(:name, :pets => [:name, :species]) Pet.restful_publish(:person_id, :name) # person_id gets converted to a link automagically. @person = Person.create(:name => "Jimmy Jones", :current_location => "Under a tree") @pet = @person.pets.create(:name => "Mietze", :species => "cat") end teardown do reset_config end specify "should be able to convert a collection to an array of resources" do resources = Restful::Rails.tools.convert_collection_to_resources(@person, :pets, Restful.cfg) pet = resources.first resources.size.should.equal 1 pet.url.should.equal @pet.to_restful.url end end
Version data entries
23 entries across 23 versions & 4 rubygems