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

Version Path
benjaminkrause-restful-0.2.8 test/rails/active_record_metadata_test.rb
moviepilot-restful-0.2.18 test/rails/active_record_metadata_test.rb
moviepilot-restful-0.2.19 test/rails/active_record_metadata_test.rb
moviepilot-restful-0.2.20 test/rails/active_record_metadata_test.rb
purzelrakete-restful-0.2.1 test/rails/active_record_metadata_test.rb
purzelrakete-restful-0.2.10 test/rails/active_record_metadata_test.rb
purzelrakete-restful-0.2.11 test/rails/active_record_metadata_test.rb
purzelrakete-restful-0.2.12 test/rails/active_record_metadata_test.rb
purzelrakete-restful-0.2.13 test/rails/active_record_metadata_test.rb
purzelrakete-restful-0.2.14 test/rails/active_record_metadata_test.rb
purzelrakete-restful-0.2.15 test/rails/active_record_metadata_test.rb
purzelrakete-restful-0.2.16 test/rails/active_record_metadata_test.rb
purzelrakete-restful-0.2.17 test/rails/active_record_metadata_test.rb
purzelrakete-restful-0.2.18 test/rails/active_record_metadata_test.rb
purzelrakete-restful-0.2.2 test/rails/active_record_metadata_test.rb
purzelrakete-restful-0.2.3 test/rails/active_record_metadata_test.rb
purzelrakete-restful-0.2.4 test/rails/active_record_metadata_test.rb
purzelrakete-restful-0.2.5 test/rails/active_record_metadata_test.rb
purzelrakete-restful-0.2.6 test/rails/active_record_metadata_test.rb
purzelrakete-restful-0.2.7 test/rails/active_record_metadata_test.rb