mirror of
https://github.com/nov/fb_graph2
synced 2023-03-27 23:22:15 -04:00
more specs
This commit is contained in:
parent
b11bf90f35
commit
805ea39ca6
6 changed files with 162 additions and 0 deletions
18
spec/fb_graph2/edge/links_spec.rb
Normal file
18
spec/fb_graph2/edge/links_spec.rb
Normal file
|
@ -0,0 +1,18 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe FbGraph2::Edge::Links do
|
||||
context 'included in User' do
|
||||
let(:me) { FbGraph2::User.me('token') }
|
||||
describe '#links' do
|
||||
it 'should return an Array of FbGraph2::Post' do
|
||||
posts = mock_graph :get, 'me/links', 'user/links', access_token: 'token' do
|
||||
me.links
|
||||
end
|
||||
posts.should_not be_blank
|
||||
posts.each do |post|
|
||||
post.should be_instance_of FbGraph2::Post
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
18
spec/fb_graph2/edge/posts_spec.rb
Normal file
18
spec/fb_graph2/edge/posts_spec.rb
Normal file
|
@ -0,0 +1,18 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe FbGraph2::Edge::Posts do
|
||||
context 'included in User' do
|
||||
let(:me) { FbGraph2::User.me('token') }
|
||||
describe '#posts' do
|
||||
it 'should return an Array of FbGraph2::Post' do
|
||||
posts = mock_graph :get, 'me/posts', 'user/posts', access_token: 'token' do
|
||||
me.posts
|
||||
end
|
||||
posts.should_not be_blank
|
||||
posts.each do |post|
|
||||
post.should be_instance_of FbGraph2::Post
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
18
spec/fb_graph2/edge/statuses_spec.rb
Normal file
18
spec/fb_graph2/edge/statuses_spec.rb
Normal file
|
@ -0,0 +1,18 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe FbGraph2::Edge::Statuses do
|
||||
context 'included in User' do
|
||||
let(:me) { FbGraph2::User.me('token') }
|
||||
describe '#statuses' do
|
||||
it 'should return an Array of FbGraph2::Post' do
|
||||
posts = mock_graph :get, 'me/statuses', 'user/statuses', access_token: 'token' do
|
||||
me.statuses
|
||||
end
|
||||
posts.should_not be_blank
|
||||
posts.each do |post|
|
||||
post.should be_instance_of FbGraph2::Post
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
45
spec/mock_json/user/links.json
Normal file
45
spec/mock_json/user/links.json
Normal file
|
@ -0,0 +1,45 @@
|
|||
{
|
||||
"data": [{
|
||||
"id": "10152480998332277",
|
||||
"from": {
|
||||
"id": "579612276",
|
||||
"name": "Nov Matake"
|
||||
},
|
||||
"picture": "https://fbexternal-a.akamaihd.net/safe_image.php?d=AQCtEdPdezKIoUxo&w=154&h=154&url=http%3A%2F%2Fi.yimg.jp%2Fi%2Fdocs%2Frelease%2Ffbicon.jpg",
|
||||
"privacy": {
|
||||
"description": "Your friends",
|
||||
"value": "ALL_FRIENDS",
|
||||
"allow": "",
|
||||
"deny": "",
|
||||
"networks": "",
|
||||
"friends": ""
|
||||
},
|
||||
"link": "http://docs.yahoo.co.jp/docs/info/terms/chapter1.html#cf2nd",
|
||||
"name": "ヤフー株式会社 - サービス利用規約 第1編 基本ガイドライン",
|
||||
"description": "Yahoo! JAPANのサービス利用規約、第1編 基本ガイドラインは当社のサービスをご利用になるすべての方に共通して適用されます。",
|
||||
"icon": "https://fbstatic-a.akamaihd.net/rsrc.php/v2/yD/r/aS8ecmYRys0.gif",
|
||||
"created_time": "2014-06-02T09:34:13+0000",
|
||||
"likes": {
|
||||
"data": [{
|
||||
"id": "689134294485152",
|
||||
"name": "Shunya Iriki"
|
||||
}, {
|
||||
"id": "1246364330",
|
||||
"name": "Kaoru Maeda"
|
||||
}],
|
||||
"paging": {
|
||||
"cursors": {
|
||||
"after": "MTI0NjM2NDMzMA==",
|
||||
"before": "Njg5MTM0Mjk0NDg1MTUy"
|
||||
}
|
||||
}
|
||||
}
|
||||
}],
|
||||
"paging": {
|
||||
"cursors": {
|
||||
"after": "MTAxNTI0NDIwNzU4MzIyNzc=",
|
||||
"before": "MTAxNTI0ODA5OTgzMzIyNzc="
|
||||
},
|
||||
"next": "https://graph.facebook.com/v2.0/579612276/links?limit=25&after=MTAxNTI0NDIwNzU4MzIyNzc="
|
||||
}
|
||||
}
|
48
spec/mock_json/user/posts.json
Normal file
48
spec/mock_json/user/posts.json
Normal file
|
@ -0,0 +1,48 @@
|
|||
{
|
||||
"data": [{
|
||||
"id": "579612276_10152483324277277",
|
||||
"from": {
|
||||
"id": "579612276",
|
||||
"name": "Nov Matake"
|
||||
},
|
||||
"to": {
|
||||
"data": [{
|
||||
"id": "579612276",
|
||||
"name": "Nov Matake"
|
||||
}]
|
||||
},
|
||||
"message": "Nov Matake test",
|
||||
"message_tags": {
|
||||
"0": [{
|
||||
"id": "579612276",
|
||||
"name": "Nov Matake",
|
||||
"type": "user",
|
||||
"offset": 0,
|
||||
"length": 10
|
||||
}]
|
||||
},
|
||||
"actions": [{
|
||||
"name": "Comment",
|
||||
"link": "https://www.facebook.com/579612276/posts/10152483324277277"
|
||||
}, {
|
||||
"name": "Like",
|
||||
"link": "https://www.facebook.com/579612276/posts/10152483324277277"
|
||||
}],
|
||||
"privacy": {
|
||||
"description": "Your friends",
|
||||
"value": "ALL_FRIENDS",
|
||||
"friends": "",
|
||||
"networks": "",
|
||||
"allow": "",
|
||||
"deny": ""
|
||||
},
|
||||
"type": "status",
|
||||
"status_type": "mobile_status_update",
|
||||
"created_time": "2014-06-03T06:27:21+0000",
|
||||
"updated_time": "2014-06-03T06:27:21+0000"
|
||||
}],
|
||||
"paging": {
|
||||
"previous": "https://graph.facebook.com/v2.0/579612276/posts?limit=1&since=1401776841",
|
||||
"next": "https://graph.facebook.com/v2.0/579612276/posts?limit=1&until=1401776840"
|
||||
}
|
||||
}
|
15
spec/mock_json/user/statuses.json
Normal file
15
spec/mock_json/user/statuses.json
Normal file
|
@ -0,0 +1,15 @@
|
|||
{
|
||||
"data": [{
|
||||
"id": "10152483324277277",
|
||||
"from": {
|
||||
"id": "579612276",
|
||||
"name": "Nov Matake"
|
||||
},
|
||||
"message": "Nov Matake test",
|
||||
"updated_time": "2014-06-03T06:27:20+0000"
|
||||
}],
|
||||
"paging": {
|
||||
"previous": "https://graph.facebook.com/v2.0/579612276/statuses?limit=25&since=1401776840&__paging_token=enc_Aex8IwVNSggYJw8M6QIUUCJvf2TcGZpItipsxeT2NUupXAxD-01jC8oRxhDe9gGnJD-vMkN1tDEUjTuE83vcaIpq",
|
||||
"next": "https://graph.facebook.com/v2.0/579612276/statuses?limit=25&until=1384770778&__paging_token=enc_AewaF0Qo-zXVeD8fMKMQBs0GKoqDw6LXxOZhyn2z9HqW7_NBd1IvqlGOXrrL7DPpJNvx1A8-0G0_pf_OauViIb3I"
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue