public
Description: A ruby client for freebase
Clone URL: git://github.com/dustin/ruby-freebase.git
chriseppstein (author)
Sun Feb 03 12:15:22 -0800 2008
commit  a631c2035df055d70560a7a7a248a146cc1ee69f
tree    1dba0c62d357e1b0a8e15588fc2f3dd531c055f3
parent  70ce157b1061accaa86c21b5694dd592dec21ac5
ruby-freebase / test / freebase_test.rb
100644 37 lines (35 sloc) 1.16 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
require 'test/unit'
require File.dirname(__FILE__)+'/test_helper'
 
class FreebaseTest < Test::Unit::TestCase
  # Replace this with your real tests.
  def test_load_music_artist
    Freebase::Types::Music::Artist
  end
  def test_find_first_artist
    assert_kind_of Freebase::Types::Music::Artist,
                   (artist = Freebase::Types::Music::Artist.find(:first,:conditions => {:name => "The Police"}))
    assert_equal 20, artist.albums.size
  end
  def test_association_preloading
    artist = Freebase::Types::Music::Artist.find(:first,
      :conditions => {
        :name => {:value => ARGV[0], :lang => {:name => "English"}},
        :album => [{
          :fb_object => true,
          :name => {:value => nil, :lang => {:name => "English"}},
          :release_date => nil,
          :track => [{
            :fb_object => true,
            :length => nil,
            :name => {:value => nil, :lang => {:name => "English"}}
          }]
        }]
      }
    )
    quiesce(:find, :reload) do
      assert_equal 14, artist.albums.size
      assert_equal 8, artist.albums.first.tracks.size
      #artist.albums.first.producer
    end
  end
end