fb_graph2 0.0.4 → 0.0.5

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 (87) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +2 -0
  3. data/VERSION +1 -1
  4. data/fb_graph2.gemspec +2 -1
  5. data/lib/fb_graph2/achievement.rb +3 -1
  6. data/lib/fb_graph2/application.rb +4 -0
  7. data/lib/fb_graph2/collection.rb +1 -1
  8. data/lib/fb_graph2/edge/albums.rb +5 -0
  9. data/lib/fb_graph2/edge/blocked.rb +7 -2
  10. data/lib/fb_graph2/edge/comments.rb +1 -1
  11. data/lib/fb_graph2/edge/feed.rb +1 -1
  12. data/lib/fb_graph2/edge/notifications.rb +6 -0
  13. data/lib/fb_graph2/edge/photos.rb +1 -1
  14. data/lib/fb_graph2/edge/shared_posts.rb +1 -1
  15. data/lib/fb_graph2/edge/videos.rb +1 -1
  16. data/lib/fb_graph2/page.rb +6 -1
  17. data/lib/fb_graph2/page_category.rb +7 -0
  18. data/lib/fb_graph2/user.rb +1 -0
  19. data/spec/fb_graph2/application_spec.rb +23 -0
  20. data/spec/fb_graph2/collection_spec.rb +11 -0
  21. data/spec/fb_graph2/edge/achievements_spec.rb +18 -0
  22. data/spec/fb_graph2/edge/activities_spec.rb +18 -0
  23. data/spec/fb_graph2/edge/admins_spec.rb +40 -0
  24. data/spec/fb_graph2/edge/albums_spec.rb +30 -0
  25. data/spec/fb_graph2/edge/blocked_spec.rb +60 -0
  26. data/spec/fb_graph2/edge/books_spec.rb +18 -0
  27. data/spec/fb_graph2/edge/events_spec.rb +18 -0
  28. data/spec/fb_graph2/edge/friend_lists_spec.rb +18 -0
  29. data/spec/fb_graph2/edge/friends_spec.rb +18 -0
  30. data/spec/fb_graph2/edge/groups_spec.rb +18 -0
  31. data/spec/fb_graph2/edge/home_spec.rb +18 -0
  32. data/spec/fb_graph2/edge/interests_spec.rb +18 -0
  33. data/spec/fb_graph2/edge/invitable_friends_spec.rb +18 -0
  34. data/spec/fb_graph2/edge/likes_spec.rb +4 -4
  35. data/spec/fb_graph2/edge/links_spec.rb +18 -0
  36. data/spec/fb_graph2/edge/milestones_spec.rb +18 -0
  37. data/spec/fb_graph2/edge/movies_spec.rb +18 -0
  38. data/spec/fb_graph2/edge/music_spec.rb +18 -0
  39. data/spec/fb_graph2/edge/notifications_spec.rb +29 -0
  40. data/spec/fb_graph2/edge/permissions_spec.rb +18 -0
  41. data/spec/fb_graph2/edge/picture_spec.rb +16 -0
  42. data/spec/fb_graph2/edge/pokes_spec.rb +18 -0
  43. data/spec/fb_graph2/edge/posts_spec.rb +18 -0
  44. data/spec/fb_graph2/edge/promotable_posts_spec.rb +18 -0
  45. data/spec/fb_graph2/edge/scores_spec.rb +18 -0
  46. data/spec/fb_graph2/edge/shared_posts_spec.rb +18 -0
  47. data/spec/fb_graph2/edge/statuses_spec.rb +18 -0
  48. data/spec/fb_graph2/edge/television_spec.rb +18 -0
  49. data/spec/fb_graph2/edge/videos_spec.rb +28 -0
  50. data/spec/fb_graph2/request_filter/authenticator_spec.rb +25 -0
  51. data/spec/fb_graph2/request_filter/debugger_spec.rb +33 -0
  52. data/spec/fb_graph2/user_spec.rb +1 -1
  53. data/spec/fb_graph2/util_spec.rb +19 -0
  54. data/spec/mock_json/application/app.json +15 -0
  55. data/spec/mock_json/page/admins.json +11 -0
  56. data/spec/mock_json/page/block_succeeded.json +3 -0
  57. data/spec/mock_json/page/blocked.json +11 -0
  58. data/spec/mock_json/page/milestones.json +19 -0
  59. data/spec/mock_json/page/promotable_posts.json +67 -0
  60. data/spec/mock_json/post/shared_posts.json +50 -0
  61. data/spec/mock_json/success_true.json +3 -0
  62. data/spec/mock_json/user/achievements.json +40 -0
  63. data/spec/mock_json/user/activities.json +36 -0
  64. data/spec/mock_json/user/albums.json +23 -0
  65. data/spec/mock_json/user/books.json +11 -0
  66. data/spec/mock_json/user/events.json +16 -0
  67. data/spec/mock_json/user/friend_lists.json +98 -0
  68. data/spec/mock_json/user/friends.json +18 -0
  69. data/spec/mock_json/user/groups.json +16 -0
  70. data/spec/mock_json/user/home.json +61 -0
  71. data/spec/mock_json/user/interests.json +41 -0
  72. data/spec/mock_json/user/invitable_friends.json +27 -0
  73. data/spec/mock_json/user/links.json +45 -0
  74. data/spec/mock_json/user/movies.json +11 -0
  75. data/spec/mock_json/user/music.json +45 -0
  76. data/spec/mock_json/user/notifications.json +111 -0
  77. data/spec/mock_json/user/permissions.json +114 -0
  78. data/spec/mock_json/user/picture.json +6 -0
  79. data/spec/mock_json/user/pokes.json +17 -0
  80. data/spec/mock_json/user/posts.json +48 -0
  81. data/spec/mock_json/user/scores.json +14 -0
  82. data/spec/mock_json/user/statuses.json +15 -0
  83. data/spec/mock_json/user/television.json +11 -0
  84. data/spec/mock_json/user/videos.json +41 -0
  85. data/spec/spec_helper/mock_graph.rb +1 -1
  86. data/spec/spec_helper.rb +7 -0
  87. metadata +84 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a3b9b96bd354676b41303ec71bb42e5a37f83e79
4
- data.tar.gz: 353b8100ce89c4e3b96f832e209d4612357ff44a
3
+ metadata.gz: 74750faa426059425c7abd637447a8fdad787239
4
+ data.tar.gz: 766bad5045a521469346a990a8d63ab799eb8a7e
5
5
  SHA512:
6
- metadata.gz: 215b26018c47fa99f1da5d3cd07caaf5ff2c62e15b2bcc289a02dfccd43bacdc0d29bb34706ab568c265189ea5bbc2508733a3cf8f69d3d144b3ebf63c57bc7e
7
- data.tar.gz: 80c709b966450c3afeb9795b15a5aef28c420cde256bac977bb685654800270c14e27359f6a411769ef345a51b01288861654fbd567e488b9c83b4bcbde6c569
6
+ metadata.gz: 300cbfc8444dc6e4efaaa5ff530bc424da44304f5b46f753c8aeea9887aa0ddc0bf94fb3da45f2297ff2c3d437ad98907fbfc3f035d3431a1f6621d74d3a78cd
7
+ data.tar.gz: fb4423e27def44ce916faf226d9c96c2843fd83d8a94723417a9fa4ae19b267a8092c8b24e1f0dda5d91f4b00da23289f5e0d4ab3d140fbdb84fc9a7d7084300
data/.gitignore CHANGED
@@ -20,3 +20,5 @@ tmp
20
20
  *.o
21
21
  *.a
22
22
  mkmf.log
23
+ wiki
24
+ samples
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.4
1
+ 0.0.5
data/fb_graph2.gemspec CHANGED
@@ -20,5 +20,6 @@ Gem::Specification.new do |gem|
20
20
  gem.add_development_dependency 'rake'
21
21
  gem.add_development_dependency 'simplecov'
22
22
  gem.add_development_dependency 'webmock'
23
- gem.add_development_dependency 'rspec', '>= 2'
23
+ gem.add_development_dependency 'rspec'
24
+ gem.add_development_dependency 'rspec-its'
24
25
  end
@@ -13,7 +13,9 @@ module FbGraph2
13
13
 
14
14
  def initialize(id, attributes = {})
15
15
  super
16
- # TODO: handle custom attributes.
16
+ if attributes.include? :data
17
+ self.data = attributes[:data]
18
+ end
17
19
  end
18
20
  end
19
21
  end
@@ -23,5 +23,9 @@ module FbGraph2
23
23
  super
24
24
  # TODO: handle custom attributes.
25
25
  end
26
+
27
+ def self.app(access_token)
28
+ new(:app).authenticate access_token
29
+ end
26
30
  end
27
31
  end
@@ -2,7 +2,7 @@ module FbGraph2
2
2
  class Collection < Array
3
3
  attr_reader :previous, :next, :total_count, :unread_count, :updated_time, :cursors
4
4
 
5
- def initialize(collection = nil)
5
+ def initialize(collection)
6
6
  collection = case collection
7
7
  when Hash
8
8
  collection
@@ -7,6 +7,11 @@ module FbGraph2
7
7
  Album.new(album[:id], album).authenticate self.access_token
8
8
  end
9
9
  end
10
+
11
+ def album!(params = {})
12
+ album = self.post params, edge: :albums
13
+ Album.new(album[:id], params.merge(album)).authenticate self.access_token
14
+ end
10
15
  end
11
16
  end
12
17
  end
@@ -8,15 +8,20 @@ module FbGraph2
8
8
  end
9
9
  end
10
10
 
11
+ def blocked?(user, params = {})
12
+ users = self.edge :blocked, params, edge_scope: user
13
+ users.present?
14
+ end
15
+
11
16
  def block!(user, params = {})
12
17
  self.post params.merge(
13
- user_id: Util.as_identifier(user)
18
+ user: Util.as_identifier(user)
14
19
  ), edge: :blocked
15
20
  end
16
21
 
17
22
  def unblock!(user, params = {})
18
23
  self.delete params.merge(
19
- user_id: Util.as_identifier(user)
24
+ user: Util.as_identifier(user)
20
25
  ), edge: :blocked
21
26
  end
22
27
  end
@@ -21,7 +21,7 @@ module FbGraph2
21
21
 
22
22
  def comment!(params = {})
23
23
  comment = self.post params, edge: :comments
24
- Comment.new(comment[:id], comment.merge(params)).authenticate self.access_token
24
+ Comment.new(comment[:id], params.merge(comment)).authenticate self.access_token
25
25
  end
26
26
  end
27
27
  end
@@ -9,7 +9,7 @@ module FbGraph2
9
9
  end
10
10
 
11
11
  def feed!(params = {})
12
- post = post params, edge: :feed
12
+ post = self.post params, edge: :feed
13
13
  Post.new(post[:id], params.merge(post)).authenticate self.access_token
14
14
  end
15
15
  end
@@ -7,6 +7,12 @@ module FbGraph2
7
7
  Notification.new notification[:id], notification
8
8
  end
9
9
  end
10
+
11
+ def notification!(params = {})
12
+ notification = self.post params, edge: :notifications
13
+ notification.include? :success
14
+ end
15
+ alias_method :notify!, :notification!
10
16
  end
11
17
  end
12
18
  end
@@ -10,7 +10,7 @@ module FbGraph2
10
10
  end
11
11
 
12
12
  def photo!(params = {})
13
- photo = post params, edge: :photos
13
+ photo = self.post params, edge: :photos
14
14
  Photo.new(photo[:id], params.merge(photo)).authenticate self.access_token
15
15
  end
16
16
  end
@@ -2,7 +2,7 @@ module FbGraph2
2
2
  class Edge
3
3
  module SharedPosts
4
4
  def shared_posts(params = {})
5
- posts = self.edge :posts, params
5
+ posts = self.edge :sharedposts, params
6
6
  posts.collect do |post|
7
7
  Post.new(post[:id], post).authenticate self.access_token
8
8
  end
@@ -10,7 +10,7 @@ module FbGraph2
10
10
  end
11
11
 
12
12
  def video!(params = {})
13
- video = post params, edge: :videos
13
+ video = self.post params, edge: :videos
14
14
  Video.new(video[:id], params.merge(video)).authenticate self.access_token
15
15
  end
16
16
  end
@@ -39,7 +39,12 @@ module FbGraph2
39
39
 
40
40
  def initialize(id, attributes = {})
41
41
  super
42
- # TODO: handle custom attributes.
42
+ if attributes.include? :category_list
43
+ self.category_list = attributes[:category_list].collect do |page_category|
44
+ PageCategory.new page_category[:id], page_category
45
+ end
46
+ end
47
+ # TODO: handle other custom attributes.
43
48
  end
44
49
  end
45
50
  end
@@ -0,0 +1,7 @@
1
+ module FbGraph2
2
+ class PageCategory < Node
3
+ register_attributes(
4
+ raw: [:name]
5
+ )
6
+ end
7
+ end
@@ -11,6 +11,7 @@ module FbGraph2
11
11
  include Edge::FriendLists
12
12
  include Edge::Friends
13
13
  include Edge::Games
14
+ include Edge::Groups
14
15
  include Edge::Home
15
16
  include Edge::Interests
16
17
  include Edge::InvitableFriends
@@ -0,0 +1,23 @@
1
+ require 'spec_helper'
2
+
3
+ describe FbGraph2::User do
4
+ describe '.app' do
5
+ let(:klass) { FbGraph2::Application }
6
+
7
+ it 'should not call API' do
8
+ expect do
9
+ app = klass.app 'token'
10
+ app.should be_instance_of klass
11
+ end.not_to request_to 'app'
12
+ end
13
+
14
+ context 'when fetched' do
15
+ it 'should call API' do
16
+ app = mock_graph :get, 'app', 'application/app' do
17
+ klass.app('token').fetch
18
+ end
19
+ app.should be_instance_of klass
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,11 @@
1
+ require 'spec_helper'
2
+
3
+ describe FbGraph2::Collection do
4
+ context 'when non-collection object given' do
5
+ it do
6
+ expect do
7
+ FbGraph2::Collection.new 'scalar'
8
+ end.to raise_error ArgumentError
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,18 @@
1
+ require 'spec_helper'
2
+
3
+ describe FbGraph2::Edge::Achievements do
4
+ context 'included in User' do
5
+ describe '#achievements' do
6
+ let(:me) { FbGraph2::User.me('token') }
7
+ it 'should return an Array of FbGraph2::Achievement' do
8
+ pages = mock_graph :get, 'me/achievements', 'user/achievements', access_token: 'token' do
9
+ me.achievements
10
+ end
11
+ pages.should_not be_blank
12
+ pages.each do |page|
13
+ page.should be_instance_of FbGraph2::Achievement
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,18 @@
1
+ require 'spec_helper'
2
+
3
+ describe FbGraph2::Edge::Activities do
4
+ context 'included in User' do
5
+ describe '#activities' do
6
+ let(:me) { FbGraph2::User.me('token') }
7
+ it 'should return an Array of FbGraph2::Page' do
8
+ pages = mock_graph :get, 'me/activities', 'user/activities', access_token: 'token' do
9
+ me.activities
10
+ end
11
+ pages.should_not be_blank
12
+ pages.each do |page|
13
+ page.should be_instance_of FbGraph2::Page
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,40 @@
1
+ require 'spec_helper'
2
+
3
+ describe FbGraph2::Edge::Admins do
4
+ context 'included in Page' do
5
+ let(:page) { FbGraph2::Page.new('page_id').authenticate('page_token') }
6
+
7
+ describe '#admins' do
8
+ it 'should return an Array of FbGraph2::User' do
9
+ users = mock_graph :get, 'page_id/admins', 'page/admins', access_token: 'page_token' do
10
+ page.admins
11
+ end
12
+ users.should_not be_blank
13
+ users.each do |user|
14
+ user.should be_instance_of FbGraph2::User
15
+ end
16
+ end
17
+ end
18
+
19
+ describe '#admin?' do
20
+ let(:user_id) { 'user_id' }
21
+ let(:user) { FbGraph2::Page.new(user_id) }
22
+
23
+ context 'when String given' do
24
+ it do
25
+ mock_graph :get, "page_id/admins/#{user_id}", 'page/admins', access_token: 'page_token' do
26
+ page.admin? user_id
27
+ end.should be true
28
+ end
29
+ end
30
+
31
+ context 'when FbGraph2::User given' do
32
+ it do
33
+ mock_graph :get, "page_id/admins/#{user_id}", 'page/admins', access_token: 'page_token' do
34
+ page.admin? user
35
+ end.should be true
36
+ end
37
+ end
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,30 @@
1
+ require 'spec_helper'
2
+
3
+ describe FbGraph2::Edge::Albums do
4
+ context 'included in User' do
5
+ let(:me) { FbGraph2::User.me('token') }
6
+
7
+ describe '#albums' do
8
+ it 'should return an Array of FbGraph2::Video' do
9
+ albums = mock_graph :get, 'me/albums', 'user/albums', access_token: 'token' do
10
+ me.albums
11
+ end
12
+ albums.should_not be_blank
13
+ albums.each do |album|
14
+ album.should be_instance_of FbGraph2::Album
15
+ end
16
+ end
17
+ end
18
+
19
+ describe '#album!' do
20
+ it do
21
+ album = mock_graph :post, 'me/albums', 'success_with_id', access_token: 'token', params: {
22
+ name: 'test'
23
+ } do
24
+ me.album! name: 'test'
25
+ end
26
+ album.should be_instance_of FbGraph2::Album
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,60 @@
1
+ require 'spec_helper'
2
+
3
+ describe FbGraph2::Edge::Blocked do
4
+ context 'included in Page' do
5
+ let(:page) { FbGraph2::Page.new('page_id').authenticate('page_token') }
6
+ let(:user_id) { 'user_id' }
7
+ let(:user) { FbGraph2::Page.new(user_id) }
8
+
9
+ describe '#blocked' do
10
+ it 'should return an Array of FbGraph2::User' do
11
+ users = mock_graph :get, 'page_id/blocked', 'page/blocked', access_token: 'page_token' do
12
+ page.blocked
13
+ end
14
+ users.should_not be_blank
15
+ users.each do |user|
16
+ user.should be_instance_of FbGraph2::User
17
+ end
18
+ end
19
+ end
20
+
21
+ describe '#blocked?' do
22
+ context 'when String given' do
23
+ it do
24
+ mock_graph :get, "page_id/blocked/#{user_id}", 'page/blocked', access_token: 'page_token' do
25
+ page.blocked? user_id
26
+ end.should be true
27
+ end
28
+ end
29
+
30
+ context 'when FbGraph2::User given' do
31
+ it do
32
+ mock_graph :get, "page_id/blocked/#{user_id}", 'page/blocked', access_token: 'page_token' do
33
+ page.blocked? user
34
+ end.should be true
35
+ end
36
+ end
37
+ end
38
+
39
+ describe '#block!' do
40
+ it do
41
+ result = mock_graph :post, 'page_id/blocked', 'page/block_succeeded', access_token: 'page_token', params: {
42
+ user: user_id
43
+ } do
44
+ page.block! user
45
+ end
46
+ result.should == {'user_id' => true}
47
+ end
48
+ end
49
+
50
+ describe '#unblock!' do
51
+ it do
52
+ mock_graph :delete, 'page_id/blocked', 'true', access_token: 'page_token', params: {
53
+ user: user_id
54
+ } do
55
+ page.unblock! user
56
+ end.should be true
57
+ end
58
+ end
59
+ end
60
+ end
@@ -0,0 +1,18 @@
1
+ require 'spec_helper'
2
+
3
+ describe FbGraph2::Edge::Books do
4
+ context 'included in User' do
5
+ describe '#books' do
6
+ let(:me) { FbGraph2::User.me('token') }
7
+ it 'should return an Array of FbGraph2::Page' do
8
+ pages = mock_graph :get, 'me/books', 'user/books', access_token: 'token' do
9
+ me.books
10
+ end
11
+ pages.should_not be_blank
12
+ pages.each do |page|
13
+ page.should be_instance_of FbGraph2::Page
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,18 @@
1
+ require 'spec_helper'
2
+
3
+ describe FbGraph2::Edge::Events do
4
+ context 'included in User' do
5
+ describe '#events' do
6
+ let(:me) { FbGraph2::User.me('token') }
7
+ it 'should return an Array of FbGraph2::Event' do
8
+ events = mock_graph :get, 'me/events', 'user/events', access_token: 'token' do
9
+ me.events
10
+ end
11
+ events.should_not be_blank
12
+ events.each do |event|
13
+ event.should be_instance_of FbGraph2::Event
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,18 @@
1
+ require 'spec_helper'
2
+
3
+ describe FbGraph2::Edge::FriendLists do
4
+ context 'included in User' do
5
+ describe '#friend_lists' do
6
+ let(:me) { FbGraph2::User.me('token') }
7
+ it 'should return an Array of FbGraph2::FriendList' do
8
+ friend_lists = mock_graph :get, 'me/friendlists', 'user/friend_lists', access_token: 'token' do
9
+ me.friend_lists
10
+ end
11
+ friend_lists.should_not be_blank
12
+ friend_lists.each do |friend_list|
13
+ friend_list.should be_instance_of FbGraph2::FriendList
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,18 @@
1
+ require 'spec_helper'
2
+
3
+ describe FbGraph2::Edge::Friends do
4
+ context 'included in User' do
5
+ describe '#friends' do
6
+ let(:me) { FbGraph2::User.me('token') }
7
+ it 'should return an Array of FbGraph2::User' do
8
+ users = mock_graph :get, 'me/friends', 'user/friends', access_token: 'token' do
9
+ me.friends
10
+ end
11
+ users.should_not be_blank
12
+ users.each do |user|
13
+ user.should be_instance_of FbGraph2::User
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,18 @@
1
+ require 'spec_helper'
2
+
3
+ describe FbGraph2::Edge::Groups do
4
+ context 'included in User' do
5
+ describe '#groups' do
6
+ let(:me) { FbGraph2::User.me('token') }
7
+ it 'should return an Array of FbGraph2::Page' do
8
+ groups = mock_graph :get, 'me/groups', 'user/groups', access_token: 'token' do
9
+ me.groups
10
+ end
11
+ groups.should_not be_blank
12
+ groups.each do |group|
13
+ group.should be_instance_of FbGraph2::Group
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,18 @@
1
+ require 'spec_helper'
2
+
3
+ describe FbGraph2::Edge::Feed do
4
+ context 'included in User' do
5
+ describe '#home' do
6
+ let(:me) { FbGraph2::User.me('token') }
7
+ it 'should return an Array of FbGraph2::Post' do
8
+ posts = mock_graph :get, 'me/home', 'user/home', access_token: 'token' do
9
+ me.home
10
+ end
11
+ posts.should_not be_blank
12
+ posts.each do |post|
13
+ post.should be_instance_of FbGraph2::Post
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,18 @@
1
+ require 'spec_helper'
2
+
3
+ describe FbGraph2::Edge::Interests do
4
+ context 'included in User' do
5
+ describe '#interests' do
6
+ let(:me) { FbGraph2::User.me('token') }
7
+ it 'should return an Array of FbGraph2::Page' do
8
+ pages = mock_graph :get, 'me/interests', 'user/interests', access_token: 'token' do
9
+ me.interests
10
+ end
11
+ pages.should_not be_blank
12
+ pages.each do |page|
13
+ page.should be_instance_of FbGraph2::Page
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,18 @@
1
+ require 'spec_helper'
2
+
3
+ describe FbGraph2::Edge::InvitableFriends do
4
+ context 'included in User' do
5
+ describe '#invitable_friends' do
6
+ let(:me) { FbGraph2::User.me('token') }
7
+ it 'should return an Array of FbGraph2::Struct::InvitableFriend' do
8
+ users = mock_graph :get, 'me/invitable_friends', 'user/invitable_friends', access_token: 'token' do
9
+ me.invitable_friends
10
+ end
11
+ users.should_not be_blank
12
+ users.each do |user|
13
+ user.should be_instance_of FbGraph2::Struct::InvitableFriend
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
@@ -21,7 +21,7 @@ describe FbGraph2::Edge::Likes do
21
21
  it do
22
22
  mock_graph :get, 'me/likes/page_id', 'user/likes', access_token: 'token' do
23
23
  me.liked? 'page_id'
24
- end.should be_true
24
+ end.should be true
25
25
  end
26
26
  end
27
27
 
@@ -29,7 +29,7 @@ describe FbGraph2::Edge::Likes do
29
29
  it do
30
30
  mock_graph :get, 'me/likes/page_id', 'blank_collection', access_token: 'token' do
31
31
  me.liked? 'page_id'
32
- end.should be_false
32
+ end.should be false
33
33
  end
34
34
  end
35
35
  end
@@ -80,7 +80,7 @@ describe FbGraph2::Edge::Likes do
80
80
  it 'should return true' do
81
81
  mock_graph :post, 'post_id/likes', 'true', access_token: 'token' do
82
82
  post.like!
83
- end.should be_true
83
+ end.should be true
84
84
  end
85
85
  end
86
86
 
@@ -88,7 +88,7 @@ describe FbGraph2::Edge::Likes do
88
88
  it 'should return true' do
89
89
  mock_graph :delete, 'post_id/likes', 'true', access_token: 'token' do
90
90
  post.unlike!
91
- end.should be_true
91
+ end.should be true
92
92
  end
93
93
  end
94
94
  end
@@ -0,0 +1,18 @@
1
+ require 'spec_helper'
2
+
3
+ describe FbGraph2::Edge::Links do
4
+ context 'included in User' do
5
+ let(:me) { FbGraph2::User.me('token') }
6
+ describe '#links' do
7
+ it 'should return an Array of FbGraph2::Post' do
8
+ posts = mock_graph :get, 'me/links', 'user/links', access_token: 'token' do
9
+ me.links
10
+ end
11
+ posts.should_not be_blank
12
+ posts.each do |post|
13
+ post.should be_instance_of FbGraph2::Post
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,18 @@
1
+ require 'spec_helper'
2
+
3
+ describe FbGraph2::Edge::Milestones do
4
+ context 'included in Page' do
5
+ describe '#milestones' do
6
+ let(:page) { FbGraph2::Page.new('page_id').authenticate('token') }
7
+ it 'should return an Array of FbGraph2::Milestone' do
8
+ milestones = mock_graph :get, 'page_id/milestones', 'page/milestones', access_token: 'token' do
9
+ page.milestones
10
+ end
11
+ milestones.should_not be_blank
12
+ milestones.each do |milestone|
13
+ milestone.should be_instance_of FbGraph2::Milestone
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,18 @@
1
+ require 'spec_helper'
2
+
3
+ describe FbGraph2::Edge::Movies do
4
+ context 'included in User' do
5
+ describe '#movies' do
6
+ let(:me) { FbGraph2::User.me('token') }
7
+ it 'should return an Array of FbGraph2::Page' do
8
+ pages = mock_graph :get, 'me/movies', 'user/movies', access_token: 'token' do
9
+ me.movies
10
+ end
11
+ pages.should_not be_blank
12
+ pages.each do |page|
13
+ page.should be_instance_of FbGraph2::Page
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end