fb_graph 0.0.1

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 (49) hide show
  1. data/.document +5 -0
  2. data/.gitignore +21 -0
  3. data/LICENSE +20 -0
  4. data/README.rdoc +17 -0
  5. data/Rakefile +49 -0
  6. data/VERSION +1 -0
  7. data/fb_graph.gemspec +107 -0
  8. data/lib/fb_graph/connections/collection.rb +31 -0
  9. data/lib/fb_graph/connections/feed.rb +9 -0
  10. data/lib/fb_graph/connections/home.rb +9 -0
  11. data/lib/fb_graph/connections/likes.rb +12 -0
  12. data/lib/fb_graph/connections/picture.rb +14 -0
  13. data/lib/fb_graph/connections/posts.rb +15 -0
  14. data/lib/fb_graph/connections/statuses.rb +12 -0
  15. data/lib/fb_graph/connections/tagged.rb +9 -0
  16. data/lib/fb_graph/connections.rb +6 -0
  17. data/lib/fb_graph/node.rb +62 -0
  18. data/lib/fb_graph/page.rb +14 -0
  19. data/lib/fb_graph/post.rb +39 -0
  20. data/lib/fb_graph/status.rb +18 -0
  21. data/lib/fb_graph/user.rb +31 -0
  22. data/lib/fb_graph.rb +26 -0
  23. data/spec/fake_json/pages/platform_private.json +13 -0
  24. data/spec/fake_json/pages/platform_public.json +13 -0
  25. data/spec/fake_json/pages/statuses/platform_private.json +258 -0
  26. data/spec/fake_json/pages/statuses/platform_public.json +6 -0
  27. data/spec/fake_json/users/arjun_private.json +99 -0
  28. data/spec/fake_json/users/arjun_public.json +7 -0
  29. data/spec/fake_json/users/home/arjun_private.json +6 -0
  30. data/spec/fake_json/users/home/arjun_public.json +6 -0
  31. data/spec/fake_json/users/home/me_private.json +383 -0
  32. data/spec/fake_json/users/home/me_public.json +6 -0
  33. data/spec/fake_json/users/likes/arjun_private.json +1394 -0
  34. data/spec/fake_json/users/likes/arjun_public.json +6 -0
  35. data/spec/fake_json/users/statuses/arjun_private.json +233 -0
  36. data/spec/fake_json/users/statuses/arjun_public.json +6 -0
  37. data/spec/fb_graph/connections/collection_spec.rb +15 -0
  38. data/spec/fb_graph/connections/home_spec.rb +38 -0
  39. data/spec/fb_graph/connections/likes_spec.rb +33 -0
  40. data/spec/fb_graph/connections/picture_spec.rb +29 -0
  41. data/spec/fb_graph/connections/statuses_spec.rb +83 -0
  42. data/spec/fb_graph/node_spec.rb +13 -0
  43. data/spec/fb_graph/page_spec.rb +19 -0
  44. data/spec/fb_graph/user_spec.rb +41 -0
  45. data/spec/fb_graph_spec.rb +13 -0
  46. data/spec/helpers/fake_json_helper.rb +9 -0
  47. data/spec/spec.opts +3 -0
  48. data/spec/spec_helper.rb +18 -0
  49. metadata +155 -0
@@ -0,0 +1,6 @@
1
+ {
2
+ "error": {
3
+ "type": "OAuthAccessTokenException",
4
+ "message": "An access token is required to request this resource."
5
+ }
6
+ }
@@ -0,0 +1,233 @@
1
+ {
2
+ "data": [
3
+ {
4
+ "id": "113559395341627",
5
+ "from": {
6
+ "name": "Arjun Banker",
7
+ "id": "7901103"
8
+ },
9
+ "message": "http://www.facebook.com/photo.php?pid=60538827&l=79b44ffb74&id=7901103",
10
+ "updated_time": "2010-04-21T21:10:16+0000"
11
+ },
12
+ {
13
+ "id": "113006625387889",
14
+ "from": {
15
+ "name": "Arjun Banker",
16
+ "id": "7901103"
17
+ },
18
+ "message": "yah",
19
+ "updated_time": "2010-04-14T01:58:09+0000"
20
+ },
21
+ {
22
+ "id": "118087664869717",
23
+ "from": {
24
+ "name": "Arjun Banker",
25
+ "id": "7901103"
26
+ },
27
+ "message": "yah",
28
+ "updated_time": "2010-04-14T01:53:34+0000"
29
+ },
30
+ {
31
+ "id": "111092362246825",
32
+ "from": {
33
+ "name": "Arjun Banker",
34
+ "id": "7901103"
35
+ },
36
+ "message": "grilled cheeze-to sammich",
37
+ "updated_time": "2010-04-08T00:23:24+0000"
38
+ },
39
+ {
40
+ "id": "115351335144169",
41
+ "from": {
42
+ "name": "Arjun Banker",
43
+ "id": "7901103"
44
+ },
45
+ "message": "supdog",
46
+ "updated_time": "2010-04-07T20:59:02+0000"
47
+ },
48
+ {
49
+ "id": "111792875511975",
50
+ "from": {
51
+ "name": "Arjun Banker",
52
+ "id": "7901103"
53
+ },
54
+ "message": "supdog",
55
+ "updated_time": "2010-04-07T20:57:16+0000"
56
+ },
57
+ {
58
+ "id": "109087099123828",
59
+ "from": {
60
+ "name": "Arjun Banker",
61
+ "id": "7901103"
62
+ },
63
+ "message": "supdog",
64
+ "updated_time": "2010-04-07T20:53:29+0000"
65
+ },
66
+ {
67
+ "id": "113278292024686",
68
+ "from": {
69
+ "name": "Arjun Banker",
70
+ "id": "7901103"
71
+ },
72
+ "message": "supdog",
73
+ "updated_time": "2010-04-07T20:51:17+0000"
74
+ },
75
+ {
76
+ "id": "108903379144257",
77
+ "from": {
78
+ "name": "Arjun Banker",
79
+ "id": "7901103"
80
+ },
81
+ "message": "supdog",
82
+ "updated_time": "2010-04-07T20:47:16+0000"
83
+ },
84
+ {
85
+ "id": "101875609854861",
86
+ "from": {
87
+ "name": "Arjun Banker",
88
+ "id": "7901103"
89
+ },
90
+ "message": "whattup",
91
+ "updated_time": "2010-04-04T07:21:36+0000"
92
+ },
93
+ {
94
+ "id": "110359368986184",
95
+ "from": {
96
+ "name": "Arjun Banker",
97
+ "id": "7901103"
98
+ },
99
+ "message": "yowza",
100
+ "updated_time": "2010-04-04T05:25:57+0000"
101
+ },
102
+ {
103
+ "id": "109922795696831",
104
+ "from": {
105
+ "name": "Arjun Banker",
106
+ "id": "7901103"
107
+ },
108
+ "message": "yowza",
109
+ "updated_time": "2010-04-04T05:25:18+0000"
110
+ },
111
+ {
112
+ "id": "107433192621362",
113
+ "from": {
114
+ "name": "Arjun Banker",
115
+ "id": "7901103"
116
+ },
117
+ "message": "sup",
118
+ "updated_time": "2010-04-01T00:28:41+0000"
119
+ },
120
+ {
121
+ "id": "105627472803438",
122
+ "from": {
123
+ "name": "Arjun Banker",
124
+ "id": "7901103"
125
+ },
126
+ "message": "agoria says, you must destroy before you rebuild.",
127
+ "updated_time": "2010-03-27T02:16:07+0000"
128
+ },
129
+ {
130
+ "id": "326320620657",
131
+ "from": {
132
+ "name": "Arjun Banker",
133
+ "id": "7901103"
134
+ },
135
+ "message": "cheese wakka zorp",
136
+ "updated_time": "2010-02-24T03:19:50+0000"
137
+ },
138
+ {
139
+ "id": "317278423393",
140
+ "from": {
141
+ "name": "Arjun Banker",
142
+ "id": "7901103"
143
+ },
144
+ "message": "the music is different here, the vibrations are different...not like planet earth",
145
+ "updated_time": "2010-02-19T23:45:13+0000"
146
+ },
147
+ {
148
+ "id": "346569706534",
149
+ "from": {
150
+ "name": "Arjun Banker",
151
+ "id": "7901103"
152
+ },
153
+ "message": "wow, new gmail users default to the Buzz tab.",
154
+ "updated_time": "2010-02-18T21:47:40+0000"
155
+ },
156
+ {
157
+ "id": "308051440818",
158
+ "from": {
159
+ "name": "Arjun Banker",
160
+ "id": "7901103"
161
+ },
162
+ "message": "House-Heads, last night was incredible. You outdo yourselves every time. Bravo.",
163
+ "updated_time": "2010-02-15T00:46:26+0000"
164
+ },
165
+ {
166
+ "id": "328857844611",
167
+ "from": {
168
+ "name": "Arjun Banker",
169
+ "id": "7901103"
170
+ },
171
+ "message": "trying to enjoy apple juice",
172
+ "updated_time": "2010-02-12T00:46:49+0000"
173
+ },
174
+ {
175
+ "id": "291946912009",
176
+ "from": {
177
+ "name": "Arjun Banker",
178
+ "id": "7901103"
179
+ },
180
+ "message": "finally received our order of camel-flavored Snuggies for DungeonBeds.",
181
+ "updated_time": "2010-02-06T01:41:58+0000"
182
+ },
183
+ {
184
+ "id": "281642603470",
185
+ "from": {
186
+ "name": "Arjun Banker",
187
+ "id": "7901103"
188
+ },
189
+ "message": "\"Let's go flip some Gatekeepers!\" - Austin Haugen",
190
+ "updated_time": "2010-02-05T05:27:11+0000"
191
+ },
192
+ {
193
+ "id": "313449204401",
194
+ "from": {
195
+ "name": "Arjun Banker",
196
+ "id": "7901103"
197
+ },
198
+ "message": "select unread -> archive",
199
+ "updated_time": "2010-02-04T06:11:35+0000"
200
+ },
201
+ {
202
+ "id": "310020815119",
203
+ "from": {
204
+ "name": "Arjun Banker",
205
+ "id": "7901103"
206
+ },
207
+ "message": "hello up, goodbye down",
208
+ "updated_time": "2010-01-30T23:57:06+0000"
209
+ },
210
+ {
211
+ "id": "441224140149",
212
+ "from": {
213
+ "name": "Arjun Banker",
214
+ "id": "7901103"
215
+ },
216
+ "message": "cheese balls wakka wakka zorp",
217
+ "updated_time": "2010-01-26T23:39:19+0000"
218
+ },
219
+ {
220
+ "id": "258870336453",
221
+ "from": {
222
+ "name": "Arjun Banker",
223
+ "id": "7901103"
224
+ },
225
+ "message": "everything that is everywhere is in the Bharata, and what is not is nowhere",
226
+ "updated_time": "2010-01-08T06:55:12+0000"
227
+ }
228
+ ],
229
+ "paging": {
230
+ "previous": "https://graph.facebook.com/7901103/statuses?token=2227470867%7C2.WYzVDx_3poIwJP1QNQ2vwg__.3600.1272117600-579612276%7CvNhS2UE8VCENmslKMACDszaJrDw.&limit=25&since=2010-04-21T21%3A10%3A16%2B0000",
231
+ "next": "https://graph.facebook.com/7901103/statuses?token=2227470867%7C2.WYzVDx_3poIwJP1QNQ2vwg__.3600.1272117600-579612276%7CvNhS2UE8VCENmslKMACDszaJrDw.&limit=25&until=2010-01-08T06%3A55%3A12%2B0000"
232
+ }
233
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "error": {
3
+ "type": "OAuthAccessTokenException",
4
+ "message": "An access token is required to request this resource."
5
+ }
6
+ }
@@ -0,0 +1,15 @@
1
+ require File.join(File.dirname(__FILE__), '../../spec_helper')
2
+
3
+ describe FbGraph::Connections::Collection do
4
+ before(:all) do
5
+ fake_json(:get, 'platform/statuses', 'pages/statuses/platform_public')
6
+ fake_json(:get, 'platform/statuses?access_token=access_token', 'pages/statuses/platform_private')
7
+ end
8
+
9
+ it 'should be a kind of Array with previous and next params' do
10
+ statuses = FbGraph::Page.new('platform', :access_token => 'access_token').statuses
11
+ statuses.should be_kind_of(Array)
12
+ statuses.previous.should be_kind_of(Hash)
13
+ statuses.next.should be_kind_of(Hash)
14
+ end
15
+ end
@@ -0,0 +1,38 @@
1
+ require File.join(File.dirname(__FILE__), '../../spec_helper')
2
+
3
+ describe FbGraph::Connections::Home, '#home' do
4
+ describe 'when included by FbGraph::User' do
5
+ before(:all) do
6
+ fake_json(:get, 'me/home', 'users/home/me_public')
7
+ fake_json(:get, 'me/home?access_token=access_token', 'users/home/me_private')
8
+ fake_json(:get, 'arjun/home', 'users/home/arjun_public')
9
+ fake_json(:get, 'arjun/home?access_token=access_token', 'users/home/arjun_private')
10
+ end
11
+
12
+ it 'should raise FbGraph::Exception when no access_token given' do
13
+ lambda do
14
+ FbGraph::User.new('arjun').home
15
+ end.should raise_exception(FbGraph::Exception)
16
+ end
17
+
18
+ it 'should raise FbGraph::Exception when identifier is not me' do
19
+ lambda do
20
+ FbGraph::User.new('arjun', :access_token => 'access_token').home
21
+ end.should raise_exception(FbGraph::Exception)
22
+ end
23
+
24
+ it 'shoud raise FbGraph::NotFound when identifier is me and no access_token is given' do
25
+ lambda do
26
+ FbGraph::User.new('me').home
27
+ end.should raise_exception(FbGraph::NotFound)
28
+ end
29
+
30
+ it 'shoud return posts when identifier is me and access_token is given' do
31
+ posts = FbGraph::User.new('me', :access_token => 'access_token').home
32
+ posts.each do |post|
33
+ post.should be_instance_of(FbGraph::Post)
34
+ end
35
+ end
36
+
37
+ end
38
+ end
@@ -0,0 +1,33 @@
1
+ require File.join(File.dirname(__FILE__), '../../spec_helper')
2
+
3
+ describe FbGraph::Connections::Likes, '#likes' do
4
+ describe 'when included by FbGraph::User' do
5
+ before(:all) do
6
+ fake_json(:get, 'arjun/likes', 'users/likes/arjun_public')
7
+ fake_json(:get, 'arjun/likes?access_token=access_token', 'users/likes/arjun_private')
8
+ end
9
+
10
+ it 'should raise FbGraph::Unauthorized when no access_token given' do
11
+ lambda do
12
+ FbGraph::User.new('arjun').likes
13
+ end.should raise_exception(FbGraph::Unauthorized)
14
+ end
15
+
16
+ it 'should return liked pages' do
17
+ likes = FbGraph::User.new('arjun', :access_token => 'access_token').likes
18
+ likes.first.should == FbGraph::Page.new(
19
+ '378209722137',
20
+ :name => 'Doing Things at the Last Minute',
21
+ :category => '活動'
22
+ )
23
+ likes.last.should == FbGraph::Page.new(
24
+ '329322570299',
25
+ :name => 'Dirtybird Records',
26
+ :category => 'Products_other'
27
+ )
28
+ likes.each do |like|
29
+ like.should be_instance_of(FbGraph::Page)
30
+ end
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,29 @@
1
+ require File.join(File.dirname(__FILE__), '../../spec_helper')
2
+
3
+ describe FbGraph::Connections::Picture, '#picture' do
4
+
5
+ describe 'when included by FbGraph::User' do
6
+ it 'should return image url' do
7
+ FbGraph::User.new('matake').picture.should == File.join(FbGraph::ROOT_URL, 'matake/picture')
8
+ end
9
+
10
+ it 'should support size option' do
11
+ [:square, :large].each do |size|
12
+ FbGraph::User.new('matake').picture(size).should == File.join(FbGraph::ROOT_URL, "matake/picture?type=#{size}")
13
+ end
14
+ end
15
+ end
16
+
17
+ describe 'when included by FbGraph::Page' do
18
+ it 'should return image url' do
19
+ FbGraph::Page.new('platform').picture.should == File.join(FbGraph::ROOT_URL, 'platform/picture')
20
+ end
21
+
22
+ it 'should support size option' do
23
+ [:square, :large].each do |size|
24
+ FbGraph::Page.new('platform').picture(size).should == File.join(FbGraph::ROOT_URL, "platform/picture?type=#{size}")
25
+ end
26
+ end
27
+ end
28
+
29
+ end
@@ -0,0 +1,83 @@
1
+ require File.join(File.dirname(__FILE__), '../../spec_helper')
2
+
3
+ describe FbGraph::Connections::Statuses, '#statuses' do
4
+
5
+ describe 'when included by FbGraph::User' do
6
+ before(:all) do
7
+ fake_json(:get, 'arjun/statuses', 'users/statuses/arjun_public')
8
+ fake_json(:get, 'arjun/statuses?access_token=access_token', 'users/statuses/arjun_private')
9
+ end
10
+
11
+ it 'should raise FbGraph::Unauthorized when no access_token given' do
12
+ lambda do
13
+ FbGraph::User.new('arjun').statuses
14
+ end.should raise_exception(FbGraph::Unauthorized)
15
+ end
16
+
17
+ it 'should return statuses' do
18
+ statuses = FbGraph::User.new('arjun', :access_token => 'access_token').statuses
19
+ statuses.first.should == FbGraph::Status.new(
20
+ '113559395341627',
21
+ :from => {
22
+ :id => '7901103',
23
+ :name => 'Arjun Banker'
24
+ },
25
+ :message => 'http://www.facebook.com/photo.php?pid=60538827&l=79b44ffb74&id=7901103',
26
+ :updated_time => '2010-04-21T21:10:16+0000'
27
+ )
28
+ statuses.last.should == FbGraph::Status.new(
29
+ '258870336453',
30
+ :from => {
31
+ :id => '7901103',
32
+ :name => 'Arjun Banker'
33
+ },
34
+ :message => 'everything that is everywhere is in the Bharata, and what is not is nowhere',
35
+ :updated_time => '2010-01-08T06:55:12+0000'
36
+ )
37
+ statuses.each do |like|
38
+ like.should be_instance_of(FbGraph::Status)
39
+ end
40
+ end
41
+ end
42
+
43
+ describe 'when included by FbGraph::Page' do
44
+ before(:all) do
45
+ fake_json(:get, 'platform/statuses', 'pages/statuses/platform_public')
46
+ fake_json(:get, 'platform/statuses?access_token=access_token', 'pages/statuses/platform_private')
47
+ end
48
+
49
+ it 'should raise FbGraph::Unauthorized when no access_token given' do
50
+ lambda do
51
+ FbGraph::Page.new('platform').statuses
52
+ end.should raise_exception(FbGraph::Unauthorized)
53
+ end
54
+
55
+ it 'should return statuses with pagination info' do
56
+ statuses = FbGraph::Page.new('platform', :access_token => 'access_token').statuses
57
+ statuses.first.should == FbGraph::Status.new(
58
+ '111081598927600',
59
+ :from => {
60
+ :id => '19292868552',
61
+ :name => 'Facebook Platform',
62
+ :category => 'Technology'
63
+ },
64
+ :message => 'Here\'s more information on the new social plugins announced at f8 today - http://bit.ly/db8ahS',
65
+ :updated_time => '2010-04-21T20:17:04+0000'
66
+ )
67
+ statuses.last.should == FbGraph::Status.new(
68
+ '59328281651',
69
+ :from => {
70
+ :id => '19292868552',
71
+ :name => 'Facebook Platform',
72
+ :category => 'Technology'
73
+ },
74
+ :message => 'http://developers.facebook.com/news.php?blog=1&story=209',
75
+ :updated_time => '2009-03-06T22:56:36+0000'
76
+ )
77
+ statuses.each do |like|
78
+ like.should be_instance_of(FbGraph::Status)
79
+ end
80
+ end
81
+ end
82
+
83
+ end
@@ -0,0 +1,13 @@
1
+ require File.join(File.dirname(__FILE__), '../spec_helper')
2
+
3
+ describe FbGraph::Node, '#initialize' do
4
+
5
+ it 'should setup endpoint' do
6
+ FbGraph::Node.new('matake').endpoint.should == File.join(FbGraph::ROOT_URL, 'matake')
7
+ end
8
+
9
+ it 'should support access_token option' do
10
+ FbGraph::Node.new('matake', :access_token => 'access_token').access_token.should == 'access_token'
11
+ end
12
+
13
+ end
@@ -0,0 +1,19 @@
1
+ require File.join(File.dirname(__FILE__), '../spec_helper')
2
+
3
+ describe FbGraph::Page, '.fetch' do
4
+ before(:all) do
5
+ fake_json(:get, 'platform', 'pages/platform_public')
6
+ fake_json(:get, 'platform?access_token=access_token', 'pages/platform_private')
7
+ end
8
+
9
+ it 'should get page attributes' do
10
+ page = FbGraph::Page.fetch('platform')
11
+ page.identifier.should == '19292868552'
12
+ page.name.should == 'Facebook Platform'
13
+ page.category.should == 'Technology'
14
+ end
15
+
16
+ it 'should not require access_token' do
17
+ FbGraph::Page.fetch('platform', :access_token => 'access_token').should == FbGraph::Page.fetch('platform')
18
+ end
19
+ end
@@ -0,0 +1,41 @@
1
+ require File.join(File.dirname(__FILE__), '../spec_helper')
2
+
3
+ describe FbGraph::User, '.me' do
4
+ it 'should return FbGraph::User instance with access_token' do
5
+ FbGraph::User.me('access_token').should == FbGraph::User.new('me', :access_token => 'access_token')
6
+ end
7
+ end
8
+
9
+ describe FbGraph::User, '.fetch' do
10
+ before(:all) do
11
+ fake_json(:get, 'arjun', 'users/arjun_public')
12
+ fake_json(:get, 'arjun?access_token=access_token', 'users/arjun_private')
13
+ end
14
+
15
+ it 'should get only public profile when no access_token given' do
16
+ user = FbGraph::User.fetch('arjun')
17
+ user.name.should == 'Arjun Banker'
18
+ user.first_name.should == 'Arjun'
19
+ user.last_name.should == 'Banker'
20
+ user.identifier.should == '7901103'
21
+ user.link.should == 'http://www.facebook.com/Arjun'
22
+ end
23
+
24
+ it 'should get public + private profile when access_token given' do
25
+ user = FbGraph::User.fetch('arjun', :access_token => 'access_token')
26
+ # public
27
+ user.name.should == 'Arjun Banker'
28
+ user.first_name.should == 'Arjun'
29
+ user.last_name.should == 'Banker'
30
+ user.identifier.should == '7901103'
31
+ user.link.should == 'http://www.facebook.com/Arjun'
32
+
33
+ # private
34
+ user.about.should == "squish squash\npip pop\nfizz bang"
35
+ user.birthday.should == '04/15/1984'
36
+ user.work.should == [{'position'=>{'name'=>'Software Engineer', 'id'=>107879555911138}, 'start_date'=>'2007-11', 'location'=>{'name'=>'Palo Alto, California', 'id'=>104022926303756}, 'employer'=>{'name'=>'Facebook', 'id'=>20531316728}}, {'position'=>{'name'=>'Business Intelligence Analyst', 'id'=>105918922782444}, 'start_date'=>'2006-03', 'employer'=>{'name'=>'Zillow', 'id'=>113816405300191}, 'end_date'=>'2007-10'}, {'position'=>{'name'=>'SDET', 'id'=>110006949022640}, 'start_date'=>'2004-08', 'employer'=>{'name'=>'Microsoft', 'id'=>20528438720}, 'end_date'=>'2006-03'}, {'position'=>{'name'=>'Programmer Analyst', 'id'=>110344568993267}, 'start_date'=>'2003-06', 'employer'=>{'name'=>'Dell', 'id'=>7706457055}, 'end_date'=>'2004-07'}]
37
+ user.education.should == [{'school'=>{'name'=>'Texas Academy Of Math And Science', 'id'=>107922345906866}, 'year'=>{'name'=>'2001', 'id'=>102241906483610}}, {'school'=>{'name'=>'The University of Texas at Austin', 'id'=>24147741537}, 'concentration'=>[{'name'=>'Computer Science', 'id'=>116831821660155}], 'year'=>{'name'=>'2003', 'id'=>108077232558120}}]
38
+ user.email.should == nil
39
+ user.website.should == nil
40
+ end
41
+ end
@@ -0,0 +1,13 @@
1
+ require File.join(File.dirname(__FILE__), 'spec_helper')
2
+
3
+ describe FbGraph, '#node' do
4
+ it "should return FbGraph::Node instance" do
5
+ FbGraph.node('matake').should == FbGraph::Node.new('matake')
6
+ end
7
+ end
8
+
9
+ describe FbGraph, '#user' do
10
+ it "should return FbGraph::User instance" do
11
+ FbGraph.user('matake').should == FbGraph::User.new('matake')
12
+ end
13
+ end
@@ -0,0 +1,9 @@
1
+ module FakeJsonHelper
2
+ def fake_json(method, path, file_path)
3
+ FakeWeb.register_uri(
4
+ method,
5
+ File.join(FbGraph::ROOT_URL, path),
6
+ :body => File.read(File.join(File.dirname(__FILE__), '../fake_json', "#{file_path}.json"))
7
+ )
8
+ end
9
+ end
data/spec/spec.opts ADDED
@@ -0,0 +1,3 @@
1
+ --colour
2
+ --format
3
+ specdoc
@@ -0,0 +1,18 @@
1
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
2
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
3
+
4
+ require 'spec'
5
+ require 'spec/autorun'
6
+ require 'fb_graph'
7
+ require 'rubygems'
8
+ require 'fakeweb'
9
+ require 'helpers/fake_json_helper'
10
+ include FakeJsonHelper
11
+ FakeWeb.allow_net_connect = false
12
+
13
+
14
+ Spec::Runner.configure do |config|
15
+ config.before(:all) do
16
+
17
+ end
18
+ end