fb_graph 0.0.8 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (92) hide show
  1. data/VERSION +1 -1
  2. data/fb_graph.gemspec +63 -2
  3. data/lib/fb_graph/album.rb +6 -3
  4. data/lib/fb_graph/comment.rb +1 -1
  5. data/lib/fb_graph/connections/attending.rb +1 -5
  6. data/lib/fb_graph/connections/declined.rb +1 -5
  7. data/lib/fb_graph/connections/invited.rb +1 -5
  8. data/lib/fb_graph/connections/maybe.rb +1 -5
  9. data/lib/fb_graph/connections/members.rb +2 -6
  10. data/lib/fb_graph/connections/noreply.rb +1 -5
  11. data/lib/fb_graph/event.rb +19 -9
  12. data/lib/fb_graph/group.rb +1 -1
  13. data/lib/fb_graph/link.rb +1 -1
  14. data/lib/fb_graph/node.rb +26 -26
  15. data/lib/fb_graph/note.rb +2 -2
  16. data/lib/fb_graph/photo.rb +11 -8
  17. data/lib/fb_graph/post.rb +2 -2
  18. data/lib/fb_graph/status.rb +1 -1
  19. data/lib/fb_graph/tag.rb +1 -1
  20. data/lib/fb_graph/user.rb +3 -1
  21. data/lib/fb_graph/video.rb +2 -2
  22. data/lib/fb_graph.rb +11 -6
  23. data/spec/fake_json/albums/photos/matake_private.json +97 -0
  24. data/spec/fake_json/albums/photos/post_with_valid_access_token.json +1 -0
  25. data/spec/fake_json/events/attending/post_with_valid_access_token.json +1 -0
  26. data/spec/fake_json/events/attending/smartday_private.json +44 -0
  27. data/spec/fake_json/events/declined/post_with_valid_access_token.json +1 -0
  28. data/spec/fake_json/events/declined/smartday_private.json +720 -0
  29. data/spec/fake_json/events/invited/smartday_private.json +7092 -0
  30. data/spec/fake_json/events/maybe/post_with_valid_access_token.json +1 -0
  31. data/spec/fake_json/events/maybe/smartday_private.json +956 -0
  32. data/spec/fake_json/events/noreply/smartday_private.json +896 -0
  33. data/spec/fake_json/groups/members/emacs_private.json +1996 -0
  34. data/spec/fake_json/pages/notes/post_with_valid_access_token.json +1 -0
  35. data/spec/fake_json/posts/comments/post_with_invalid_access_token.json +1 -0
  36. data/spec/fake_json/posts/comments/post_with_valid_access_token.json +1 -0
  37. data/spec/fake_json/posts/comments/post_without_access_token.json +1 -0
  38. data/spec/fake_json/posts/likes/post_with_invalid_access_token.json +1 -0
  39. data/spec/fake_json/posts/likes/post_with_valid_access_token.json +1 -0
  40. data/spec/fake_json/posts/likes/post_without_access_token.json +1 -0
  41. data/spec/fake_json/users/albums/post_with_valid_access_token.json +1 -0
  42. data/spec/fake_json/users/events/post_with_valid_access_token.json +1 -0
  43. data/spec/fake_json/users/feed/post_with_invalid_access_token.json +1 -0
  44. data/spec/fake_json/users/feed/post_with_valid_access_token.json +1 -0
  45. data/spec/fake_json/users/feed/post_without_access_token.json +1 -0
  46. data/spec/fake_json/users/interests/matake_private.json +14 -0
  47. data/spec/fake_json/users/links/matake_private.json +221 -0
  48. data/spec/fake_json/users/links/post_with_valid_access_token.json +1 -0
  49. data/spec/fake_json/users/movies/matake_private.json +9 -0
  50. data/spec/fake_json/users/music/matake_private.json +34 -0
  51. data/spec/fake_json/users/notes/matake_private.json +308 -0
  52. data/spec/fake_json/users/television/matake_private.json +9 -0
  53. data/spec/fake_json/users/videos/kirk_private.json +41 -0
  54. data/spec/fb_graph/album_spec.rb +1 -1
  55. data/spec/fb_graph/collection_spec.rb +1 -1
  56. data/spec/fb_graph/comment_spec.rb +1 -1
  57. data/spec/fb_graph/connections/activities_spec.rb +2 -2
  58. data/spec/fb_graph/connections/albums_spec.rb +18 -2
  59. data/spec/fb_graph/connections/attending_spec.rb +24 -0
  60. data/spec/fb_graph/connections/comments_spec.rb +83 -0
  61. data/spec/fb_graph/connections/declined_spec.rb +24 -0
  62. data/spec/fb_graph/connections/events_spec.rb +20 -2
  63. data/spec/fb_graph/connections/feed_spec.rb +42 -2
  64. data/spec/fb_graph/connections/interests_spec.rb +14 -0
  65. data/spec/fb_graph/connections/invited_spec.rb +14 -0
  66. data/spec/fb_graph/connections/likes_spec.rb +2 -2
  67. data/spec/fb_graph/connections/links_spec.rb +32 -0
  68. data/spec/fb_graph/connections/maybe_spec.rb +24 -0
  69. data/spec/fb_graph/connections/members_spec.rb +14 -0
  70. data/spec/fb_graph/connections/movies_spec.rb +14 -0
  71. data/spec/fb_graph/connections/music_spec.rb +14 -0
  72. data/spec/fb_graph/connections/noreply_spec.rb +14 -0
  73. data/spec/fb_graph/connections/notes_spec.rb +31 -0
  74. data/spec/fb_graph/connections/photos_spec.rb +29 -0
  75. data/spec/fb_graph/connections/television_spec.rb +14 -0
  76. data/spec/fb_graph/connections/videos_spec.rb +14 -0
  77. data/spec/fb_graph/education_spec.rb +1 -1
  78. data/spec/fb_graph/event_spec.rb +1 -1
  79. data/spec/fb_graph/group_spec.rb +1 -1
  80. data/spec/fb_graph/link_spec.rb +1 -1
  81. data/spec/fb_graph/node_spec.rb +1 -1
  82. data/spec/fb_graph/note_spec.rb +1 -1
  83. data/spec/fb_graph/photo_spec.rb +1 -1
  84. data/spec/fb_graph/post_spec.rb +1 -1
  85. data/spec/fb_graph/status_spec.rb +1 -1
  86. data/spec/fb_graph/tag_spec.rb +1 -1
  87. data/spec/fb_graph/user_spec.rb +9 -0
  88. data/spec/fb_graph/venue_spec.rb +1 -1
  89. data/spec/fb_graph/video_spec.rb +1 -1
  90. data/spec/fb_graph/work_spec.rb +1 -1
  91. data/spec/helpers/fake_json_helper.rb +4 -2
  92. metadata +64 -3
@@ -1,7 +1,7 @@
1
1
  require File.join(File.dirname(__FILE__), '../../spec_helper')
2
2
 
3
- describe FbGraph::Connections::Albums, '#albums' do
4
- context 'when included by FbGraph::User' do
3
+ context 'when included by FbGraph::User' do
4
+ describe FbGraph::Connections::Albums, '#albums' do
5
5
  before(:all) do
6
6
  fake_json(:get, 'matake/albums', 'users/albums/matake_public')
7
7
  fake_json(:get, 'matake/albums?access_token=access_token', 'users/albums/matake_private')
@@ -36,4 +36,20 @@ describe FbGraph::Connections::Albums, '#albums' do
36
36
  end
37
37
  end
38
38
  end
39
+
40
+ describe FbGraph::Connections::Albums, '#album!' do
41
+ before do
42
+ fake_json(:post, 'matake/albums', 'users/albums/post_with_valid_access_token')
43
+ end
44
+
45
+ it 'should return generated album' do
46
+ album = FbGraph::User.new('matake', :access_token => 'valid').album!(
47
+ :name => 'FbGraph test',
48
+ :message => 'test test test'
49
+ )
50
+ album.identifier.should == 401096332276
51
+ album.name.should == 'FbGraph test'
52
+ album.description.should == 'test test test'
53
+ end
54
+ end
39
55
  end
@@ -0,0 +1,24 @@
1
+ require File.join(File.dirname(__FILE__), '../../spec_helper')
2
+
3
+ describe FbGraph::Connections::Attending, '#attending' do
4
+ before(:all) do
5
+ fake_json(:get, 'smartday/attending?access_token=access_token', 'events/attending/smartday_private')
6
+ end
7
+
8
+ it 'should return attending users as FbGraph::User' do
9
+ users = FbGraph::Event.new('smartday', :access_token => 'access_token').attending
10
+ users.each do |user|
11
+ user.should be_instance_of(FbGraph::User)
12
+ end
13
+ end
14
+ end
15
+
16
+ describe FbGraph::Connections::Attending, '#attending!' do
17
+ before do
18
+ fake_json(:post, '12345/attending', 'events/attending/post_with_valid_access_token')
19
+ end
20
+
21
+ it 'should return true' do
22
+ FbGraph::Event.new('12345', :access_token => 'valid').attending!.should be_true
23
+ end
24
+ end
@@ -0,0 +1,83 @@
1
+ require File.join(File.dirname(__FILE__), '../../spec_helper')
2
+
3
+ context 'when included by FbGraph::Post' do
4
+
5
+ describe FbGraph::Connections::Comments, '#comments' do
6
+ # TODO
7
+ end
8
+
9
+ describe FbGraph::Connections::Comments, '#comment!' do
10
+ context 'when no access_token given' do
11
+ before do
12
+ fake_json(:post, '12345/comments', 'posts/comments/post_without_access_token', :status => [500, 'Internal Server Error'])
13
+ end
14
+
15
+ it 'should raise FbGraph::Exception' do
16
+ lambda do
17
+ FbGraph::Post.new('12345').comment!(:message => 'hello')
18
+ end.should raise_exception(FbGraph::Exception)
19
+ end
20
+ end
21
+
22
+ context 'when invalid access_token is given' do
23
+ before do
24
+ fake_json(:post, '12345/comments', 'posts/comments/post_with_invalid_access_token', :status => [500, 'Internal Server Error'])
25
+ end
26
+
27
+ it 'should raise FbGraph::Exception' do
28
+ lambda do
29
+ FbGraph::Post.new('12345', :access_token => 'invalid').comment!(:message => 'hello')
30
+ end.should raise_exception(FbGraph::Exception)
31
+ end
32
+ end
33
+
34
+ context 'when valid access_token is given' do
35
+ before do
36
+ fake_json(:post, '12345/comments', 'posts/comments/post_with_valid_access_token')
37
+ end
38
+
39
+ it 'should return generated comment' do
40
+ comment = FbGraph::Post.new('12345', :access_token => 'valid').comment!(:message => 'hello')
41
+ comment.identifier.should == '117513961602338_119401698085884_535271'
42
+ comment.message.should == 'hello'
43
+ end
44
+ end
45
+ end
46
+
47
+ describe FbGraph::Connections::Comments, '#like!' do
48
+ context 'when no access_token given' do
49
+ before do
50
+ fake_json(:post, '12345/likes', 'posts/likes/post_without_access_token', :status => [500, 'Internal Server Error'])
51
+ end
52
+
53
+ it 'should raise FbGraph::Exception' do
54
+ lambda do
55
+ FbGraph::Post.new('12345').like!
56
+ end.should raise_exception(FbGraph::Exception)
57
+ end
58
+ end
59
+
60
+ context 'when invalid access_token is given' do
61
+ before do
62
+ fake_json(:post, '12345/likes', 'posts/likes/post_with_invalid_access_token', :status => [500, 'Internal Server Error'])
63
+ end
64
+
65
+ it 'should raise FbGraph::Exception' do
66
+ lambda do
67
+ FbGraph::Post.new('12345', :access_token => 'invalid').like!
68
+ end.should raise_exception(FbGraph::Exception)
69
+ end
70
+ end
71
+
72
+ context 'when valid access_token is given' do
73
+ before do
74
+ fake_json(:post, '12345/likes', 'posts/likes/post_with_valid_access_token')
75
+ end
76
+
77
+ it 'should return true' do
78
+ FbGraph::Post.new('12345', :access_token => 'valid').like!.should be_true
79
+ end
80
+ end
81
+ end
82
+
83
+ end
@@ -0,0 +1,24 @@
1
+ require File.join(File.dirname(__FILE__), '../../spec_helper')
2
+
3
+ describe FbGraph::Connections::Declined, '#declined' do
4
+ before(:all) do
5
+ fake_json(:get, 'smartday/declined?access_token=access_token', 'events/declined/smartday_private')
6
+ end
7
+
8
+ it 'should return declined users as FbGraph::User' do
9
+ users = FbGraph::Event.new('smartday', :access_token => 'access_token').declined
10
+ users.each do |user|
11
+ user.should be_instance_of(FbGraph::User)
12
+ end
13
+ end
14
+ end
15
+
16
+ describe FbGraph::Connections::Declined, '#declined!' do
17
+ before do
18
+ fake_json(:post, '12345/declined', 'events/declined/post_with_valid_access_token')
19
+ end
20
+
21
+ it 'should return true' do
22
+ FbGraph::Event.new('12345', :access_token => 'valid').declined!.should be_true
23
+ end
24
+ end
@@ -1,7 +1,7 @@
1
1
  require File.join(File.dirname(__FILE__), '../../spec_helper')
2
2
 
3
- describe FbGraph::Connections::Events, '#events' do
4
- context 'when included by FbGraph::User' do
3
+ context 'when included by FbGraph::User' do
4
+ describe FbGraph::Connections::Events, '#events' do
5
5
  before(:all) do
6
6
  fake_json(:get, 'matake/events', 'users/events/matake_public')
7
7
  fake_json(:get, 'matake/events?access_token=access_token', 'users/events/matake_private')
@@ -31,4 +31,22 @@ describe FbGraph::Connections::Events, '#events' do
31
31
  end
32
32
  end
33
33
  end
34
+
35
+ describe FbGraph::Connections::Events, '#events!' do
36
+ before do
37
+ fake_json(:post, 'matake/events', 'users/events/post_with_valid_access_token')
38
+ end
39
+
40
+ it 'should return generated note' do
41
+ puts Time.utc(2010,5,11,9,0).to_i
42
+ event = FbGraph::User.new('matake', :access_token => 'valid').event!(
43
+ :name => 'FbGraph test event',
44
+ :start_time => Time.utc(2010, 5, 11, 10, 0, 0).to_i,
45
+ :end_time => Time.utc(2010, 5, 11, 12, 0, 0).to_i
46
+ )
47
+ event.name.should == 'FbGraph test event'
48
+ event.start_time.should == Time.utc(2010, 5, 11, 10, 0, 0)
49
+ event.end_time.should == Time.utc(2010, 5, 11, 12, 0, 0)
50
+ end
51
+ end
34
52
  end
@@ -1,7 +1,8 @@
1
1
  require File.join(File.dirname(__FILE__), '../../spec_helper')
2
2
 
3
- describe FbGraph::Connections::Feed, '#feed' do
4
- context 'when included by FbGraph::User' do
3
+ context 'when included by FbGraph::User' do
4
+
5
+ describe FbGraph::Connections::Feed, '#feed' do
5
6
  before(:all) do
6
7
  fake_json(:get, 'arjun/feed', 'users/feed/arjun_public')
7
8
  fake_json(:get, 'arjun/feed?access_token=access_token', 'users/feed/arjun_private')
@@ -32,4 +33,43 @@ describe FbGraph::Connections::Feed, '#feed' do
32
33
  end
33
34
  end
34
35
  end
36
+
37
+ describe FbGraph::Connections::Feed, '#feed!' do
38
+ context 'when no access_token given' do
39
+ before do
40
+ fake_json(:post, 'matake/feed', 'users/feed/post_without_access_token', :status => [500, 'Internal Server Error'])
41
+ end
42
+
43
+ it 'should raise FbGraph::Exception' do
44
+ lambda do
45
+ FbGraph::User.new('matake').feed!(:message => 'hello')
46
+ end.should raise_exception(FbGraph::Exception)
47
+ end
48
+ end
49
+
50
+ context 'when invalid access_token is given' do
51
+ before do
52
+ fake_json(:post, 'matake/feed', 'users/feed/post_with_invalid_access_token', :status => [500, 'Internal Server Error'])
53
+ end
54
+
55
+ it 'should raise FbGraph::Exception' do
56
+ lambda do
57
+ FbGraph::User.new('matake', :access_token => 'invalid').feed!(:message => 'hello')
58
+ end.should raise_exception(FbGraph::Exception)
59
+ end
60
+ end
61
+
62
+ context 'when valid access_token is given' do
63
+ before do
64
+ fake_json(:post, 'matake/feed', 'users/feed/post_with_valid_access_token')
65
+ end
66
+
67
+ it 'should return generated post' do
68
+ post = FbGraph::User.new('matake', :access_token => 'valid').feed!(:message => 'hello')
69
+ post.identifier.should == '579612276_401071652276'
70
+ post.message.should == 'hello'
71
+ end
72
+ end
73
+ end
74
+
35
75
  end
@@ -0,0 +1,14 @@
1
+ require File.join(File.dirname(__FILE__), '../../spec_helper')
2
+
3
+ describe FbGraph::Connections::Interests, '#interests' do
4
+ before(:all) do
5
+ fake_json(:get, 'matake/interests?access_token=access_token', 'users/interests/matake_private')
6
+ end
7
+
8
+ it 'should return interests pages as FbGraph::Page' do
9
+ pages = FbGraph::User.new('matake', :access_token => 'access_token').interests
10
+ pages.each do |page|
11
+ page.should be_instance_of(FbGraph::Page)
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,14 @@
1
+ require File.join(File.dirname(__FILE__), '../../spec_helper')
2
+
3
+ describe FbGraph::Connections::Invited, '#invited' do
4
+ before(:all) do
5
+ fake_json(:get, 'smartday/invited?access_token=access_token', 'events/invited/smartday_private')
6
+ end
7
+
8
+ it 'should return invited users as FbGraph::User' do
9
+ users = FbGraph::Event.new('smartday', :access_token => 'access_token').invited
10
+ users.each do |user|
11
+ user.should be_instance_of(FbGraph::User)
12
+ end
13
+ end
14
+ end
@@ -1,7 +1,7 @@
1
1
  require File.join(File.dirname(__FILE__), '../../spec_helper')
2
2
 
3
- describe FbGraph::Connections::Likes, '#likes' do
4
- context 'when included by FbGraph::User' do
3
+ context 'when included by FbGraph::User' do
4
+ describe FbGraph::Connections::Likes, '#likes' do
5
5
  before(:all) do
6
6
  fake_json(:get, 'arjun/likes', 'users/likes/arjun_public')
7
7
  fake_json(:get, 'arjun/likes?access_token=access_token', 'users/likes/arjun_private')
@@ -0,0 +1,32 @@
1
+ require File.join(File.dirname(__FILE__), '../../spec_helper')
2
+
3
+ context 'when included by FbGraph::User' do
4
+ describe FbGraph::Connections::Links, '#links' do
5
+ before(:all) do
6
+ fake_json(:get, 'matake/links?access_token=access_token', 'users/links/matake_private')
7
+ end
8
+
9
+ it 'should return notes as FbGraph::Link' do
10
+ links = FbGraph::User.new('matake', :access_token => 'access_token').links
11
+ links.each do |link|
12
+ link.should be_instance_of(FbGraph::Link)
13
+ end
14
+ end
15
+ end
16
+
17
+ describe FbGraph::Connections::Links, '#link!' do
18
+ before do
19
+ fake_json(:post, 'matake/links', 'users/links/post_with_valid_access_token')
20
+ end
21
+
22
+ it 'should return generated link' do
23
+ link = FbGraph::User.new('matake', :access_token => 'valid').link!(
24
+ :link => 'http://github.com/nov/fb_graph',
25
+ :message => 'A Ruby wrapper for Facebook Graph API.'
26
+ )
27
+ link.identifier.should == 120765121284251
28
+ link.link.should == 'http://github.com/nov/fb_graph'
29
+ link.message.should == 'A Ruby wrapper for Facebook Graph API.'
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,24 @@
1
+ require File.join(File.dirname(__FILE__), '../../spec_helper')
2
+
3
+ describe FbGraph::Connections::Maybe, '#maybe' do
4
+ before(:all) do
5
+ fake_json(:get, 'smartday/maybe?access_token=access_token', 'events/maybe/smartday_private')
6
+ end
7
+
8
+ it 'should return maybe users as FbGraph::User' do
9
+ users = FbGraph::Event.new('smartday', :access_token => 'access_token').maybe
10
+ users.each do |user|
11
+ user.should be_instance_of(FbGraph::User)
12
+ end
13
+ end
14
+ end
15
+
16
+ describe FbGraph::Connections::Maybe, '#maybe!' do
17
+ before do
18
+ fake_json(:post, '12345/maybe', 'events/maybe/post_with_valid_access_token')
19
+ end
20
+
21
+ it 'should return true' do
22
+ FbGraph::Event.new('12345', :access_token => 'valid').maybe!.should be_true
23
+ end
24
+ end
@@ -0,0 +1,14 @@
1
+ require File.join(File.dirname(__FILE__), '../../spec_helper')
2
+
3
+ describe FbGraph::Connections::Friends, '#friends' do
4
+ before(:all) do
5
+ fake_json(:get, 'emacs/members?access_token=access_token', 'groups/members/emacs_private')
6
+ end
7
+
8
+ it 'should return members as FbGraph::User' do
9
+ users = FbGraph::Group.new('emacs', :access_token => 'access_token').members
10
+ users.each do |user|
11
+ user.should be_instance_of(FbGraph::User)
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,14 @@
1
+ require File.join(File.dirname(__FILE__), '../../spec_helper')
2
+
3
+ describe FbGraph::Connections::Movies, '#movies' do
4
+ before(:all) do
5
+ fake_json(:get, 'matake/movies?access_token=access_token', 'users/movies/matake_private')
6
+ end
7
+
8
+ it 'should return movies pages as FbGraph::Page' do
9
+ pages = FbGraph::User.new('matake', :access_token => 'access_token').movies
10
+ pages.each do |page|
11
+ page.should be_instance_of(FbGraph::Page)
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,14 @@
1
+ require File.join(File.dirname(__FILE__), '../../spec_helper')
2
+
3
+ describe FbGraph::Connections::Music, '#music' do
4
+ before(:all) do
5
+ fake_json(:get, 'matake/music?access_token=access_token', 'users/music/matake_private')
6
+ end
7
+
8
+ it 'should return music pages as FbGraph::Page' do
9
+ pages = FbGraph::User.new('matake', :access_token => 'access_token').music
10
+ pages.each do |page|
11
+ page.should be_instance_of(FbGraph::Page)
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,14 @@
1
+ require File.join(File.dirname(__FILE__), '../../spec_helper')
2
+
3
+ describe FbGraph::Connections::Noreply, '#noreply' do
4
+ before(:all) do
5
+ fake_json(:get, 'smartday/noreply?access_token=access_token', 'events/noreply/smartday_private')
6
+ end
7
+
8
+ it 'should return noreply users as FbGraph::User' do
9
+ users = FbGraph::Event.new('smartday', :access_token => 'access_token').noreply
10
+ users.each do |user|
11
+ user.should be_instance_of(FbGraph::User)
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,31 @@
1
+ require File.join(File.dirname(__FILE__), '../../spec_helper')
2
+
3
+ context 'when included by FbGraph::User' do
4
+ describe FbGraph::Connections::Notes, '#notes' do
5
+ before(:all) do
6
+ fake_json(:get, 'matake/notes?access_token=access_token', 'users/notes/matake_private')
7
+ end
8
+
9
+ it 'should return notes as FbGraph::Note' do
10
+ notes = FbGraph::User.new('matake', :access_token => 'access_token').notes
11
+ notes.each do |note|
12
+ note.should be_instance_of(FbGraph::Note)
13
+ end
14
+ end
15
+ end
16
+ end
17
+
18
+ context 'when included by FbGraph::Page' do
19
+ describe FbGraph::Connections::Notes, '#note!' do
20
+ before do
21
+ fake_json(:post, '12345/notes', 'pages/notes/post_with_valid_access_token')
22
+ end
23
+
24
+ it 'should return generated note' do
25
+ note = FbGraph::Page.new('12345', :access_token => 'valid').note!(:subject => 'test', :message => 'hello')
26
+ note.identifier.should == 396664845100
27
+ note.subject.should == 'test'
28
+ note.message.should == 'hello'
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,29 @@
1
+ require File.join(File.dirname(__FILE__), '../../spec_helper')
2
+
3
+ describe FbGraph::Connections::Photos, '#photos' do
4
+ before(:all) do
5
+ fake_json(:get, '12345/photos?access_token=access_token', 'albums/photos/matake_private')
6
+ end
7
+
8
+ it 'should return photos as FbGraph::Photo' do
9
+ photos = FbGraph::Album.new('12345', :access_token => 'access_token').photos
10
+ photos.each do |photo|
11
+ photo.should be_instance_of(FbGraph::Photo)
12
+ end
13
+ end
14
+ end
15
+
16
+ describe FbGraph::Connections::Photos, '#photo!' do
17
+ before do
18
+ fake_json(:post, '12345/photos', 'albums/photos/post_with_valid_access_token')
19
+ end
20
+
21
+ it 'should return generated photo' do
22
+ photo = FbGraph::Album.new('12345', :access_token => 'valid').photo!(
23
+ :image => Tempfile.new('image_file'),
24
+ :message => 'Hello, where is photo?'
25
+ )
26
+ photo.identifier.should == 401111132276
27
+ photo.name.should == 'Hello, where is photo?'
28
+ end
29
+ end
@@ -0,0 +1,14 @@
1
+ require File.join(File.dirname(__FILE__), '../../spec_helper')
2
+
3
+ describe FbGraph::Connections::Television, '#television' do
4
+ before(:all) do
5
+ fake_json(:get, 'matake/television?access_token=access_token', 'users/television/matake_private')
6
+ end
7
+
8
+ it 'should return television pages as FbGraph::Page' do
9
+ pages = FbGraph::User.new('matake', :access_token => 'access_token').television
10
+ pages.each do |page|
11
+ page.should be_instance_of(FbGraph::Page)
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,14 @@
1
+ require File.join(File.dirname(__FILE__), '../../spec_helper')
2
+
3
+ describe FbGraph::Connections::Videos, '#videos' do
4
+ before(:all) do
5
+ fake_json(:get, 'kirk/videos?access_token=access_token', 'users/videos/kirk_private')
6
+ end
7
+
8
+ it 'should return videos as FbGraph::Video' do
9
+ videos = FbGraph::User.new('kirk', :access_token => 'access_token').videos
10
+ videos.each do |video|
11
+ video.should be_instance_of(FbGraph::Video)
12
+ end
13
+ end
14
+ end
@@ -1,6 +1,6 @@
1
1
  require File.join(File.dirname(__FILE__), '../spec_helper')
2
2
 
3
- describe FbGraph::Education, '#new' do
3
+ describe FbGraph::Education, '.new' do
4
4
 
5
5
  it 'should setup all supported attributes' do
6
6
  attributes = {
@@ -1,6 +1,6 @@
1
1
  require File.join(File.dirname(__FILE__), '../spec_helper')
2
2
 
3
- describe FbGraph::Event, '#new' do
3
+ describe FbGraph::Event, '.new' do
4
4
 
5
5
  it 'should setup all supported attributes' do
6
6
  attributes = {
@@ -1,6 +1,6 @@
1
1
  require File.join(File.dirname(__FILE__), '../spec_helper')
2
2
 
3
- describe FbGraph::Group, '#new' do
3
+ describe FbGraph::Group, '.new' do
4
4
 
5
5
  it 'should setup all supported attributes' do
6
6
  attributes = {
@@ -1,6 +1,6 @@
1
1
  require File.join(File.dirname(__FILE__), '../spec_helper')
2
2
 
3
- describe FbGraph::Link, '#new' do
3
+ describe FbGraph::Link, '.new' do
4
4
 
5
5
  it 'should setup all supported attributes' do
6
6
  attributes = {
@@ -1,6 +1,6 @@
1
1
  require File.join(File.dirname(__FILE__), '../spec_helper')
2
2
 
3
- describe FbGraph::Node, '#new' do
3
+ describe FbGraph::Node, '.new' do
4
4
 
5
5
  it 'should setup endpoint' do
6
6
  FbGraph::Node.new('matake').endpoint.should == File.join(FbGraph::ROOT_URL, 'matake')
@@ -1,6 +1,6 @@
1
1
  require File.join(File.dirname(__FILE__), '../spec_helper')
2
2
 
3
- describe FbGraph::Note, '#new' do
3
+ describe FbGraph::Note, '.new' do
4
4
 
5
5
  it 'should setup all supported attributes' do
6
6
  attributes = {
@@ -1,6 +1,6 @@
1
1
  require File.join(File.dirname(__FILE__), '../spec_helper')
2
2
 
3
- describe FbGraph::Photo, '#new' do
3
+ describe FbGraph::Photo, '.new' do
4
4
 
5
5
  it 'should setup all supported attributes' do
6
6
  attributes = {
@@ -1,6 +1,6 @@
1
1
  require File.join(File.dirname(__FILE__), '../spec_helper')
2
2
 
3
- describe FbGraph::Post, '#new' do
3
+ describe FbGraph::Post, '.new' do
4
4
  it 'should support page as from' do
5
5
  page_post = FbGraph::Post.new('12345', :from => {
6
6
  :id => '23456',
@@ -1,6 +1,6 @@
1
1
  require File.join(File.dirname(__FILE__), '../spec_helper')
2
2
 
3
- describe FbGraph::Status, '#new' do
3
+ describe FbGraph::Status, '.new' do
4
4
 
5
5
  it 'should setup all supported attributes' do
6
6
  attributes = {
@@ -1,6 +1,6 @@
1
1
  require File.join(File.dirname(__FILE__), '../spec_helper')
2
2
 
3
- describe FbGraph::Tag, '#new' do
3
+ describe FbGraph::Tag, '.new' do
4
4
 
5
5
  it 'should setup all supported attributes' do
6
6
  attributes = {
@@ -1,5 +1,14 @@
1
1
  require File.join(File.dirname(__FILE__), '../spec_helper')
2
2
 
3
+ describe FbGraph::User, '.new' do
4
+ it 'should support year-hidden birthday' do
5
+ user = FbGraph::User.new(12345, :birthday => '12/13')
6
+ user.birthday.year.should == 0
7
+ user.birthday.month.should == 12
8
+ user.birthday.day.should == 13
9
+ end
10
+ end
11
+
3
12
  describe FbGraph::User, '.me' do
4
13
  it 'should return FbGraph::User instance with access_token' do
5
14
  FbGraph::User.me('access_token').should == FbGraph::User.new('me', :access_token => 'access_token')
@@ -1,6 +1,6 @@
1
1
  require File.join(File.dirname(__FILE__), '../spec_helper')
2
2
 
3
- describe FbGraph::Venue, '#new' do
3
+ describe FbGraph::Venue, '.new' do
4
4
 
5
5
  it 'should setup all supported attributes' do
6
6
  attributes = {
@@ -1,6 +1,6 @@
1
1
  require File.join(File.dirname(__FILE__), '../spec_helper')
2
2
 
3
- describe FbGraph::Video, '#new' do
3
+ describe FbGraph::Video, '.new' do
4
4
 
5
5
  it 'should setup all supported attributes' do
6
6
  attributes = {
@@ -1,6 +1,6 @@
1
1
  require File.join(File.dirname(__FILE__), '../spec_helper')
2
2
 
3
- describe FbGraph::Work, '#new' do
3
+ describe FbGraph::Work, '.new' do
4
4
 
5
5
  it 'should setup all supported attributes' do
6
6
  attributes = {