basuco 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,48 @@
1
+ require 'test_helper'
2
+
3
+ class ViewTest < Test::Unit::TestCase
4
+ context "A View instance" do
5
+ setup do
6
+ Ken::Logger.new(STDOUT, :info)
7
+ data = load_fixture('the_police')
8
+ @the_police = Ken::Resource.new(data)
9
+ @view = @the_police.views.first
10
+ end
11
+
12
+ should "have a type" do
13
+ @view.type.should_not be_nil
14
+ @view.type.should be_kind_of(Ken::Type)
15
+ end
16
+
17
+ should "have properties" do
18
+ @view.properties.should_not be_nil
19
+ @view.properties.each { |p| p.should be_kind_of(Ken::Property)}
20
+ end
21
+
22
+ should "have attributes" do
23
+ @view.attributes.should_not be_nil
24
+ @view.attributes.each { |p| p.should be_kind_of(Ken::Attribute)}
25
+ end
26
+
27
+ context "when accessing a direct attribute" do
28
+ setup do
29
+ @genre = @view.attribute('genre')
30
+ @album = @view.album
31
+ end
32
+
33
+ should "be kind of Ken::Attribute" do
34
+ @genre.should be_kind_of(Ken::Attribute)
35
+ @album.should be_kind_of(Ken::Attribute)
36
+ end
37
+
38
+ should "be able to get values" do
39
+ @genre.should have(6).values
40
+ @album.should have(14).values
41
+ end
42
+
43
+ should "raise AttributeNotFound when invalid propertyname is supplied" do
44
+ @view.not_existing_attribute.should be_nil
45
+ end
46
+ end # context
47
+ end # context
48
+ end # ViewTest
metadata ADDED
@@ -0,0 +1,94 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: basuco
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.3
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Caleb Bron
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2011-12-25 00:00:00.000000000Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rspec
16
+ requirement: &75454720 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :development
23
+ prerelease: false
24
+ version_requirements: *75454720
25
+ description: Transfer information from freebase.com through ruby.
26
+ email:
27
+ - ''
28
+ executables: []
29
+ extensions: []
30
+ extra_rdoc_files: []
31
+ files:
32
+ - .gitignore
33
+ - Gemfile
34
+ - LICENSE
35
+ - README.textile
36
+ - Rakefile
37
+ - basuco.gemspec
38
+ - examples/artist.rb
39
+ - examples/artist_links.rb
40
+ - lib/basuco.rb
41
+ - lib/basuco/api.rb
42
+ - lib/basuco/attribute.rb
43
+ - lib/basuco/collection.rb
44
+ - lib/basuco/property.rb
45
+ - lib/basuco/request.rb
46
+ - lib/basuco/resource.rb
47
+ - lib/basuco/search.rb
48
+ - lib/basuco/topic.rb
49
+ - lib/basuco/trans.rb
50
+ - lib/basuco/type.rb
51
+ - lib/basuco/util.rb
52
+ - lib/basuco/version.rb
53
+ - lib/basuco/view.rb
54
+ - rails/init.rb
55
+ - stats.sh
56
+ - tasks/ken.rb
57
+ - tasks/spec.rb
58
+ - test/fixtures/music_artist.json
59
+ - test/fixtures/the_police.json
60
+ - test/fixtures/the_police_topic.json
61
+ - test/integration/ken_test.rb
62
+ - test/test_helper.rb
63
+ - test/unit/attribute_test.rb
64
+ - test/unit/property_test.rb
65
+ - test/unit/resource_test.rb
66
+ - test/unit/session_test.rb
67
+ - test/unit/topic_test.rb
68
+ - test/unit/type_test.rb
69
+ - test/unit/view_test.rb
70
+ homepage: https://github.com/cbron/basuco
71
+ licenses: []
72
+ post_install_message:
73
+ rdoc_options: []
74
+ require_paths:
75
+ - lib
76
+ required_ruby_version: !ruby/object:Gem::Requirement
77
+ none: false
78
+ requirements:
79
+ - - ! '>='
80
+ - !ruby/object:Gem::Version
81
+ version: '0'
82
+ required_rubygems_version: !ruby/object:Gem::Requirement
83
+ none: false
84
+ requirements:
85
+ - - ! '>='
86
+ - !ruby/object:Gem::Version
87
+ version: '0'
88
+ requirements: []
89
+ rubyforge_project: basuco
90
+ rubygems_version: 1.8.13
91
+ signing_key:
92
+ specification_version: 3
93
+ summary: Freebase Gem
94
+ test_files: []