mirror of
https://github.com/nov/fb_graph2
synced 2023-03-27 23:22:15 -04:00
more tests & rspec3 migration
This commit is contained in:
parent
47d008c23a
commit
dc9e265b9d
53 changed files with 890 additions and 23 deletions
|
@ -20,5 +20,6 @@ Gem::Specification.new do |gem|
|
||||||
gem.add_development_dependency 'rake'
|
gem.add_development_dependency 'rake'
|
||||||
gem.add_development_dependency 'simplecov'
|
gem.add_development_dependency 'simplecov'
|
||||||
gem.add_development_dependency 'webmock'
|
gem.add_development_dependency 'webmock'
|
||||||
gem.add_development_dependency 'rspec', '>= 2'
|
gem.add_development_dependency 'rspec'
|
||||||
|
gem.add_development_dependency 'rspec-its'
|
||||||
end
|
end
|
||||||
|
|
|
@ -2,7 +2,7 @@ module FbGraph2
|
||||||
class Collection < Array
|
class Collection < Array
|
||||||
attr_reader :previous, :next, :total_count, :unread_count, :updated_time, :cursors
|
attr_reader :previous, :next, :total_count, :unread_count, :updated_time, :cursors
|
||||||
|
|
||||||
def initialize(collection = nil)
|
def initialize(collection)
|
||||||
collection = case collection
|
collection = case collection
|
||||||
when Hash
|
when Hash
|
||||||
collection
|
collection
|
||||||
|
|
|
@ -7,6 +7,11 @@ module FbGraph2
|
||||||
Album.new(album[:id], album).authenticate self.access_token
|
Album.new(album[:id], album).authenticate self.access_token
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def album!(params = {})
|
||||||
|
album = self.post params, edge: :albums
|
||||||
|
Album.new(album[:id], params.merge(album)).authenticate self.access_token
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
|
@ -8,15 +8,20 @@ module FbGraph2
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def blocked?(user, params = {})
|
||||||
|
users = self.edge :blocked, params, edge_scope: user
|
||||||
|
users.present?
|
||||||
|
end
|
||||||
|
|
||||||
def block!(user, params = {})
|
def block!(user, params = {})
|
||||||
self.post params.merge(
|
self.post params.merge(
|
||||||
user_id: Util.as_identifier(user)
|
user: Util.as_identifier(user)
|
||||||
), edge: :blocked
|
), edge: :blocked
|
||||||
end
|
end
|
||||||
|
|
||||||
def unblock!(user, params = {})
|
def unblock!(user, params = {})
|
||||||
self.delete params.merge(
|
self.delete params.merge(
|
||||||
user_id: Util.as_identifier(user)
|
user: Util.as_identifier(user)
|
||||||
), edge: :blocked
|
), edge: :blocked
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -21,7 +21,7 @@ module FbGraph2
|
||||||
|
|
||||||
def comment!(params = {})
|
def comment!(params = {})
|
||||||
comment = self.post params, edge: :comments
|
comment = self.post params, edge: :comments
|
||||||
Comment.new(comment[:id], comment.merge(params)).authenticate self.access_token
|
Comment.new(comment[:id], params.merge(comment)).authenticate self.access_token
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -9,7 +9,7 @@ module FbGraph2
|
||||||
end
|
end
|
||||||
|
|
||||||
def feed!(params = {})
|
def feed!(params = {})
|
||||||
post = post params, edge: :feed
|
post = self.post params, edge: :feed
|
||||||
Post.new(post[:id], params.merge(post)).authenticate self.access_token
|
Post.new(post[:id], params.merge(post)).authenticate self.access_token
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -10,7 +10,7 @@ module FbGraph2
|
||||||
end
|
end
|
||||||
|
|
||||||
def photo!(params = {})
|
def photo!(params = {})
|
||||||
photo = post params, edge: :photos
|
photo = self.post params, edge: :photos
|
||||||
Photo.new(photo[:id], params.merge(photo)).authenticate self.access_token
|
Photo.new(photo[:id], params.merge(photo)).authenticate self.access_token
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -10,7 +10,7 @@ module FbGraph2
|
||||||
end
|
end
|
||||||
|
|
||||||
def video!(params = {})
|
def video!(params = {})
|
||||||
video = post params, edge: :videos
|
video = self.post params, edge: :videos
|
||||||
Video.new(video[:id], params.merge(video)).authenticate self.access_token
|
Video.new(video[:id], params.merge(video)).authenticate self.access_token
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -11,6 +11,7 @@ module FbGraph2
|
||||||
include Edge::FriendLists
|
include Edge::FriendLists
|
||||||
include Edge::Friends
|
include Edge::Friends
|
||||||
include Edge::Games
|
include Edge::Games
|
||||||
|
include Edge::Groups
|
||||||
include Edge::Home
|
include Edge::Home
|
||||||
include Edge::Interests
|
include Edge::Interests
|
||||||
include Edge::InvitableFriends
|
include Edge::InvitableFriends
|
||||||
|
|
11
spec/fb_graph2/collection_spec.rb
Normal file
11
spec/fb_graph2/collection_spec.rb
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
require 'spec_helper'
|
||||||
|
|
||||||
|
describe FbGraph2::Collection do
|
||||||
|
context 'when non-collection object given' do
|
||||||
|
it do
|
||||||
|
expect do
|
||||||
|
FbGraph2::Collection.new 'scalar'
|
||||||
|
end.to raise_error ArgumentError
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -4,7 +4,7 @@ describe FbGraph2::Edge::Achievements do
|
||||||
context 'included in User' do
|
context 'included in User' do
|
||||||
describe '#achievements' do
|
describe '#achievements' do
|
||||||
let(:me) { FbGraph2::User.me('token') }
|
let(:me) { FbGraph2::User.me('token') }
|
||||||
it 'should return an Array of FbGraph2::Achievement with page token' do
|
it 'should return an Array of FbGraph2::Achievement' do
|
||||||
pages = mock_graph :get, 'me/achievements', 'user/achievements', access_token: 'token' do
|
pages = mock_graph :get, 'me/achievements', 'user/achievements', access_token: 'token' do
|
||||||
me.achievements
|
me.achievements
|
||||||
end
|
end
|
||||||
|
|
18
spec/fb_graph2/edge/activities_spec.rb
Normal file
18
spec/fb_graph2/edge/activities_spec.rb
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
require 'spec_helper'
|
||||||
|
|
||||||
|
describe FbGraph2::Edge::Activities do
|
||||||
|
context 'included in User' do
|
||||||
|
describe '#activities' do
|
||||||
|
let(:me) { FbGraph2::User.me('token') }
|
||||||
|
it 'should return an Array of FbGraph2::Page' do
|
||||||
|
pages = mock_graph :get, 'me/activities', 'user/activities', access_token: 'token' do
|
||||||
|
me.activities
|
||||||
|
end
|
||||||
|
pages.should_not be_blank
|
||||||
|
pages.each do |page|
|
||||||
|
page.should be_instance_of FbGraph2::Page
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
40
spec/fb_graph2/edge/admins_spec.rb
Normal file
40
spec/fb_graph2/edge/admins_spec.rb
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
require 'spec_helper'
|
||||||
|
|
||||||
|
describe FbGraph2::Edge::Admins do
|
||||||
|
context 'included in Page' do
|
||||||
|
let(:page) { FbGraph2::Page.new('page_id').authenticate('page_token') }
|
||||||
|
|
||||||
|
describe '#admins' do
|
||||||
|
it 'should return an Array of FbGraph2::User' do
|
||||||
|
users = mock_graph :get, 'page_id/admins', 'page/admins', access_token: 'page_token' do
|
||||||
|
page.admins
|
||||||
|
end
|
||||||
|
users.should_not be_blank
|
||||||
|
users.each do |user|
|
||||||
|
user.should be_instance_of FbGraph2::User
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
describe '#admin?' do
|
||||||
|
let(:user_id) { 'user_id' }
|
||||||
|
let(:user) { FbGraph2::Page.new(user_id) }
|
||||||
|
|
||||||
|
context 'when String given' do
|
||||||
|
it do
|
||||||
|
mock_graph :get, "page_id/admins/#{user_id}", 'page/admins', access_token: 'page_token' do
|
||||||
|
page.admin? user_id
|
||||||
|
end.should be true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'when FbGraph2::User given' do
|
||||||
|
it do
|
||||||
|
mock_graph :get, "page_id/admins/#{user_id}", 'page/admins', access_token: 'page_token' do
|
||||||
|
page.admin? user
|
||||||
|
end.should be true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
30
spec/fb_graph2/edge/albums_spec.rb
Normal file
30
spec/fb_graph2/edge/albums_spec.rb
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
require 'spec_helper'
|
||||||
|
|
||||||
|
describe FbGraph2::Edge::Albums do
|
||||||
|
context 'included in User' do
|
||||||
|
let(:me) { FbGraph2::User.me('token') }
|
||||||
|
|
||||||
|
describe '#albums' do
|
||||||
|
it 'should return an Array of FbGraph2::Video' do
|
||||||
|
albums = mock_graph :get, 'me/albums', 'user/albums', access_token: 'token' do
|
||||||
|
me.albums
|
||||||
|
end
|
||||||
|
albums.should_not be_blank
|
||||||
|
albums.each do |album|
|
||||||
|
album.should be_instance_of FbGraph2::Album
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
describe '#album!' do
|
||||||
|
it do
|
||||||
|
album = mock_graph :post, 'me/albums', 'success_with_id', access_token: 'token', params: {
|
||||||
|
name: 'test'
|
||||||
|
} do
|
||||||
|
me.album! name: 'test'
|
||||||
|
end
|
||||||
|
album.should be_instance_of FbGraph2::Album
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
60
spec/fb_graph2/edge/blocked_spec.rb
Normal file
60
spec/fb_graph2/edge/blocked_spec.rb
Normal file
|
@ -0,0 +1,60 @@
|
||||||
|
require 'spec_helper'
|
||||||
|
|
||||||
|
describe FbGraph2::Edge::Blocked do
|
||||||
|
context 'included in Page' do
|
||||||
|
let(:page) { FbGraph2::Page.new('page_id').authenticate('page_token') }
|
||||||
|
let(:user_id) { 'user_id' }
|
||||||
|
let(:user) { FbGraph2::Page.new(user_id) }
|
||||||
|
|
||||||
|
describe '#blocked' do
|
||||||
|
it 'should return an Array of FbGraph2::User' do
|
||||||
|
users = mock_graph :get, 'page_id/blocked', 'page/blocked', access_token: 'page_token' do
|
||||||
|
page.blocked
|
||||||
|
end
|
||||||
|
users.should_not be_blank
|
||||||
|
users.each do |user|
|
||||||
|
user.should be_instance_of FbGraph2::User
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
describe '#blocked?' do
|
||||||
|
context 'when String given' do
|
||||||
|
it do
|
||||||
|
mock_graph :get, "page_id/blocked/#{user_id}", 'page/blocked', access_token: 'page_token' do
|
||||||
|
page.blocked? user_id
|
||||||
|
end.should be true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'when FbGraph2::User given' do
|
||||||
|
it do
|
||||||
|
mock_graph :get, "page_id/blocked/#{user_id}", 'page/blocked', access_token: 'page_token' do
|
||||||
|
page.blocked? user
|
||||||
|
end.should be true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
describe '#block!' do
|
||||||
|
it do
|
||||||
|
result = mock_graph :post, 'page_id/blocked', 'page/block_succeeded', access_token: 'page_token', params: {
|
||||||
|
user: user_id
|
||||||
|
} do
|
||||||
|
page.block! user
|
||||||
|
end
|
||||||
|
result.should == {'user_id' => true}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
describe '#unblock!' do
|
||||||
|
it do
|
||||||
|
mock_graph :delete, 'page_id/blocked', 'true', access_token: 'page_token', params: {
|
||||||
|
user: user_id
|
||||||
|
} do
|
||||||
|
page.unblock! user
|
||||||
|
end.should be true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -4,7 +4,7 @@ describe FbGraph2::Edge::Books do
|
||||||
context 'included in User' do
|
context 'included in User' do
|
||||||
describe '#books' do
|
describe '#books' do
|
||||||
let(:me) { FbGraph2::User.me('token') }
|
let(:me) { FbGraph2::User.me('token') }
|
||||||
it 'should return an Array of FbGraph2::Page with page token' do
|
it 'should return an Array of FbGraph2::Page' do
|
||||||
pages = mock_graph :get, 'me/books', 'user/books', access_token: 'token' do
|
pages = mock_graph :get, 'me/books', 'user/books', access_token: 'token' do
|
||||||
me.books
|
me.books
|
||||||
end
|
end
|
||||||
|
|
18
spec/fb_graph2/edge/events_spec.rb
Normal file
18
spec/fb_graph2/edge/events_spec.rb
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
require 'spec_helper'
|
||||||
|
|
||||||
|
describe FbGraph2::Edge::Events do
|
||||||
|
context 'included in User' do
|
||||||
|
describe '#events' do
|
||||||
|
let(:me) { FbGraph2::User.me('token') }
|
||||||
|
it 'should return an Array of FbGraph2::Event' do
|
||||||
|
events = mock_graph :get, 'me/events', 'user/events', access_token: 'token' do
|
||||||
|
me.events
|
||||||
|
end
|
||||||
|
events.should_not be_blank
|
||||||
|
events.each do |event|
|
||||||
|
event.should be_instance_of FbGraph2::Event
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -1,7 +1,7 @@
|
||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
|
|
||||||
describe FbGraph2::Edge::FriendLists do
|
describe FbGraph2::Edge::FriendLists do
|
||||||
context 'included in Post' do
|
context 'included in User' do
|
||||||
describe '#friend_lists' do
|
describe '#friend_lists' do
|
||||||
let(:me) { FbGraph2::User.me('token') }
|
let(:me) { FbGraph2::User.me('token') }
|
||||||
it 'should return an Array of FbGraph2::FriendList' do
|
it 'should return an Array of FbGraph2::FriendList' do
|
||||||
|
|
18
spec/fb_graph2/edge/friends_spec.rb
Normal file
18
spec/fb_graph2/edge/friends_spec.rb
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
require 'spec_helper'
|
||||||
|
|
||||||
|
describe FbGraph2::Edge::Friends do
|
||||||
|
context 'included in User' do
|
||||||
|
describe '#friends' do
|
||||||
|
let(:me) { FbGraph2::User.me('token') }
|
||||||
|
it 'should return an Array of FbGraph2::User' do
|
||||||
|
users = mock_graph :get, 'me/friends', 'user/friends', access_token: 'token' do
|
||||||
|
me.friends
|
||||||
|
end
|
||||||
|
users.should_not be_blank
|
||||||
|
users.each do |user|
|
||||||
|
user.should be_instance_of FbGraph2::User
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
18
spec/fb_graph2/edge/groups_spec.rb
Normal file
18
spec/fb_graph2/edge/groups_spec.rb
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
require 'spec_helper'
|
||||||
|
|
||||||
|
describe FbGraph2::Edge::Groups do
|
||||||
|
context 'included in User' do
|
||||||
|
describe '#groups' do
|
||||||
|
let(:me) { FbGraph2::User.me('token') }
|
||||||
|
it 'should return an Array of FbGraph2::Page' do
|
||||||
|
groups = mock_graph :get, 'me/groups', 'user/groups', access_token: 'token' do
|
||||||
|
me.groups
|
||||||
|
end
|
||||||
|
groups.should_not be_blank
|
||||||
|
groups.each do |group|
|
||||||
|
group.should be_instance_of FbGraph2::Group
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
18
spec/fb_graph2/edge/home_spec.rb
Normal file
18
spec/fb_graph2/edge/home_spec.rb
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
require 'spec_helper'
|
||||||
|
|
||||||
|
describe FbGraph2::Edge::Feed do
|
||||||
|
context 'included in User' do
|
||||||
|
describe '#home' do
|
||||||
|
let(:me) { FbGraph2::User.me('token') }
|
||||||
|
it 'should return an Array of FbGraph2::Post' do
|
||||||
|
posts = mock_graph :get, 'me/home', 'user/home', access_token: 'token' do
|
||||||
|
me.home
|
||||||
|
end
|
||||||
|
posts.should_not be_blank
|
||||||
|
posts.each do |post|
|
||||||
|
post.should be_instance_of FbGraph2::Post
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -4,7 +4,7 @@ describe FbGraph2::Edge::Interests do
|
||||||
context 'included in User' do
|
context 'included in User' do
|
||||||
describe '#interests' do
|
describe '#interests' do
|
||||||
let(:me) { FbGraph2::User.me('token') }
|
let(:me) { FbGraph2::User.me('token') }
|
||||||
it 'should return an Array of FbGraph2::Page with page token' do
|
it 'should return an Array of FbGraph2::Page' do
|
||||||
pages = mock_graph :get, 'me/interests', 'user/interests', access_token: 'token' do
|
pages = mock_graph :get, 'me/interests', 'user/interests', access_token: 'token' do
|
||||||
me.interests
|
me.interests
|
||||||
end
|
end
|
||||||
|
|
18
spec/fb_graph2/edge/invitable_friends_spec.rb
Normal file
18
spec/fb_graph2/edge/invitable_friends_spec.rb
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
require 'spec_helper'
|
||||||
|
|
||||||
|
describe FbGraph2::Edge::InvitableFriends do
|
||||||
|
context 'included in User' do
|
||||||
|
describe '#invitable_friends' do
|
||||||
|
let(:me) { FbGraph2::User.me('token') }
|
||||||
|
it 'should return an Array of FbGraph2::Struct::InvitableFriend' do
|
||||||
|
users = mock_graph :get, 'me/invitable_friends', 'user/invitable_friends', access_token: 'token' do
|
||||||
|
me.invitable_friends
|
||||||
|
end
|
||||||
|
users.should_not be_blank
|
||||||
|
users.each do |user|
|
||||||
|
user.should be_instance_of FbGraph2::Struct::InvitableFriend
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -21,7 +21,7 @@ describe FbGraph2::Edge::Likes do
|
||||||
it do
|
it do
|
||||||
mock_graph :get, 'me/likes/page_id', 'user/likes', access_token: 'token' do
|
mock_graph :get, 'me/likes/page_id', 'user/likes', access_token: 'token' do
|
||||||
me.liked? 'page_id'
|
me.liked? 'page_id'
|
||||||
end.should be_true
|
end.should be true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@ describe FbGraph2::Edge::Likes do
|
||||||
it do
|
it do
|
||||||
mock_graph :get, 'me/likes/page_id', 'blank_collection', access_token: 'token' do
|
mock_graph :get, 'me/likes/page_id', 'blank_collection', access_token: 'token' do
|
||||||
me.liked? 'page_id'
|
me.liked? 'page_id'
|
||||||
end.should be_false
|
end.should be false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -80,7 +80,7 @@ describe FbGraph2::Edge::Likes do
|
||||||
it 'should return true' do
|
it 'should return true' do
|
||||||
mock_graph :post, 'post_id/likes', 'true', access_token: 'token' do
|
mock_graph :post, 'post_id/likes', 'true', access_token: 'token' do
|
||||||
post.like!
|
post.like!
|
||||||
end.should be_true
|
end.should be true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -88,7 +88,7 @@ describe FbGraph2::Edge::Likes do
|
||||||
it 'should return true' do
|
it 'should return true' do
|
||||||
mock_graph :delete, 'post_id/likes', 'true', access_token: 'token' do
|
mock_graph :delete, 'post_id/likes', 'true', access_token: 'token' do
|
||||||
post.unlike!
|
post.unlike!
|
||||||
end.should be_true
|
end.should be true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
18
spec/fb_graph2/edge/milestones_spec.rb
Normal file
18
spec/fb_graph2/edge/milestones_spec.rb
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
require 'spec_helper'
|
||||||
|
|
||||||
|
describe FbGraph2::Edge::Milestones do
|
||||||
|
context 'included in Page' do
|
||||||
|
describe '#milestones' do
|
||||||
|
let(:page) { FbGraph2::Page.new('page_id').authenticate('token') }
|
||||||
|
it 'should return an Array of FbGraph2::Milestone' do
|
||||||
|
milestones = mock_graph :get, 'page_id/milestones', 'page/milestones', access_token: 'token' do
|
||||||
|
page.milestones
|
||||||
|
end
|
||||||
|
milestones.should_not be_blank
|
||||||
|
milestones.each do |milestone|
|
||||||
|
milestone.should be_instance_of FbGraph2::Milestone
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -4,7 +4,7 @@ describe FbGraph2::Edge::Movies do
|
||||||
context 'included in User' do
|
context 'included in User' do
|
||||||
describe '#movies' do
|
describe '#movies' do
|
||||||
let(:me) { FbGraph2::User.me('token') }
|
let(:me) { FbGraph2::User.me('token') }
|
||||||
it 'should return an Array of FbGraph2::Page with page token' do
|
it 'should return an Array of FbGraph2::Page' do
|
||||||
pages = mock_graph :get, 'me/movies', 'user/movies', access_token: 'token' do
|
pages = mock_graph :get, 'me/movies', 'user/movies', access_token: 'token' do
|
||||||
me.movies
|
me.movies
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,7 +4,7 @@ describe FbGraph2::Edge::Music do
|
||||||
context 'included in User' do
|
context 'included in User' do
|
||||||
describe '#music' do
|
describe '#music' do
|
||||||
let(:me) { FbGraph2::User.me('token') }
|
let(:me) { FbGraph2::User.me('token') }
|
||||||
it 'should return an Array of FbGraph2::Page with page token' do
|
it 'should return an Array of FbGraph2::Page' do
|
||||||
pages = mock_graph :get, 'me/music', 'user/music', access_token: 'token' do
|
pages = mock_graph :get, 'me/music', 'user/music', access_token: 'token' do
|
||||||
me.music
|
me.music
|
||||||
end
|
end
|
||||||
|
|
|
@ -22,7 +22,7 @@ describe FbGraph2::Edge::Notifications do
|
||||||
href: 'href', template: 'template'
|
href: 'href', template: 'template'
|
||||||
} do
|
} do
|
||||||
user.authenticate('app_token').notification! href: 'href', template: 'template'
|
user.authenticate('app_token').notification! href: 'href', template: 'template'
|
||||||
end.should be_true
|
end.should be true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
18
spec/fb_graph2/edge/permissions_spec.rb
Normal file
18
spec/fb_graph2/edge/permissions_spec.rb
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
require 'spec_helper'
|
||||||
|
|
||||||
|
describe FbGraph2::Edge::Permissions do
|
||||||
|
context 'included in User' do
|
||||||
|
describe '#permissions' do
|
||||||
|
let(:me) { FbGraph2::User.me('token') }
|
||||||
|
it 'should return an Array of FbGraph2::Struct::Permission' do
|
||||||
|
permissions = mock_graph :get, 'me/permissions', 'user/permissions', access_token: 'token' do
|
||||||
|
me.permissions
|
||||||
|
end
|
||||||
|
permissions.should_not be_blank
|
||||||
|
permissions.each do |permission|
|
||||||
|
permission.should be_instance_of FbGraph2::Struct::Permission
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
16
spec/fb_graph2/edge/picture_spec.rb
Normal file
16
spec/fb_graph2/edge/picture_spec.rb
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
require 'spec_helper'
|
||||||
|
|
||||||
|
describe FbGraph2::Edge::Picture do
|
||||||
|
context 'included in User' do
|
||||||
|
describe '#picture' do
|
||||||
|
let(:me) { FbGraph2::User.me('token') }
|
||||||
|
it do
|
||||||
|
mock_graph :get, 'me/picture', 'user/picture', access_token: 'token', params: {
|
||||||
|
redirect: false
|
||||||
|
} do
|
||||||
|
me.picture
|
||||||
|
end.should be_instance_of FbGraph2::Struct::Picture
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
18
spec/fb_graph2/edge/promotable_posts_spec.rb
Normal file
18
spec/fb_graph2/edge/promotable_posts_spec.rb
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
require 'spec_helper'
|
||||||
|
|
||||||
|
describe FbGraph2::Edge::PromotablePosts do
|
||||||
|
context 'included in Page' do
|
||||||
|
describe '#promotable_posts' do
|
||||||
|
let(:page) { FbGraph2::Page.new('page_id').authenticate('page_token') }
|
||||||
|
it 'should return an Array of FbGraph2::Post' do
|
||||||
|
posts = mock_graph :get, 'page_id/promotable_posts', 'page/promotable_posts', access_token: 'page_token' do
|
||||||
|
page.promotable_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/scores_spec.rb
Normal file
18
spec/fb_graph2/edge/scores_spec.rb
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
require 'spec_helper'
|
||||||
|
|
||||||
|
describe FbGraph2::Edge::Scores do
|
||||||
|
context 'included in User' do
|
||||||
|
describe '#scores' do
|
||||||
|
let(:me) { FbGraph2::User.me('token') }
|
||||||
|
it 'should return an Array of FbGraph2::Struct::Score' do
|
||||||
|
scores = mock_graph :get, 'me/scores', 'user/scores', access_token: 'token' do
|
||||||
|
me.scores
|
||||||
|
end
|
||||||
|
scores.should_not be_blank
|
||||||
|
scores.each do |score|
|
||||||
|
score.should be_instance_of FbGraph2::Struct::Score
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -4,7 +4,7 @@ describe FbGraph2::Edge::Television do
|
||||||
context 'included in User' do
|
context 'included in User' do
|
||||||
describe '#television' do
|
describe '#television' do
|
||||||
let(:me) { FbGraph2::User.me('token') }
|
let(:me) { FbGraph2::User.me('token') }
|
||||||
it 'should return an Array of FbGraph2::Page with page token' do
|
it 'should return an Array of FbGraph2::Page' do
|
||||||
pages = mock_graph :get, 'me/television', 'user/television', access_token: 'token' do
|
pages = mock_graph :get, 'me/television', 'user/television', access_token: 'token' do
|
||||||
me.television
|
me.television
|
||||||
end
|
end
|
||||||
|
|
28
spec/fb_graph2/edge/videos_spec.rb
Normal file
28
spec/fb_graph2/edge/videos_spec.rb
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
require 'spec_helper'
|
||||||
|
|
||||||
|
describe FbGraph2::Edge::Videos do
|
||||||
|
context 'included in User' do
|
||||||
|
let(:me) { FbGraph2::User.me('token') }
|
||||||
|
|
||||||
|
describe '#videos' do
|
||||||
|
it 'should return an Array of FbGraph2::Video' do
|
||||||
|
videos = mock_graph :get, 'me/videos', 'user/videos', access_token: 'token' do
|
||||||
|
me.videos
|
||||||
|
end
|
||||||
|
videos.should_not be_blank
|
||||||
|
videos.each do |video|
|
||||||
|
video.should be_instance_of FbGraph2::Video
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
describe '#video!' do
|
||||||
|
it do
|
||||||
|
video = mock_graph :post, 'me/videos', 'success_with_id', access_token: 'token' do
|
||||||
|
me.video! source: File.new(__FILE__), message: 'hello'
|
||||||
|
end
|
||||||
|
video.should be_instance_of FbGraph2::Video
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -12,7 +12,7 @@ describe FbGraph2::RequestFilter::Debugger do
|
||||||
"======= [FbGraph2] API REQUEST STARTED =======",
|
"======= [FbGraph2] API REQUEST STARTED =======",
|
||||||
request.dump
|
request.dump
|
||||||
].each do |output|
|
].each do |output|
|
||||||
FbGraph2.logger.should_receive(:info).with output
|
expect(FbGraph2.logger).to receive(:info).with output
|
||||||
end
|
end
|
||||||
request_filter.filter_request(request)
|
request_filter.filter_request(request)
|
||||||
end
|
end
|
||||||
|
@ -25,7 +25,7 @@ describe FbGraph2::RequestFilter::Debugger do
|
||||||
response.dump,
|
response.dump,
|
||||||
"======= [FbGraph2] API REQUEST FINISHED ======="
|
"======= [FbGraph2] API REQUEST FINISHED ======="
|
||||||
].each do |output|
|
].each do |output|
|
||||||
FbGraph2.logger.should_receive(:info).with output
|
expect(FbGraph2.logger).to receive(:info).with output
|
||||||
end
|
end
|
||||||
request_filter.filter_response(request, response)
|
request_filter.filter_response(request, response)
|
||||||
end
|
end
|
||||||
|
|
11
spec/mock_json/page/admins.json
Normal file
11
spec/mock_json/page/admins.json
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
{
|
||||||
|
"data": [{
|
||||||
|
"name": "Nov Matake",
|
||||||
|
"role": "MANAGER",
|
||||||
|
"perms": ["ADMINISTER", "EDIT_PROFILE", "CREATE_CONTENT", "MODERATE_CONTENT", "CREATE_ADS", "BASIC_ADMIN"],
|
||||||
|
"id": "10152411392127277"
|
||||||
|
}],
|
||||||
|
"paging": {
|
||||||
|
"next": "https://graph.facebook.com/v2.0/140478125968442/admins?limit=5000&offset=5000&__after_id=enc_AewHp5mZW0v4ZorlBTo4lsBccesXKfIJsKvOM-Qb268XDhHwKtZnhOhNwXWSun5KdHE"
|
||||||
|
}
|
||||||
|
}
|
3
spec/mock_json/page/block_succeeded.json
Normal file
3
spec/mock_json/page/block_succeeded.json
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
"user_id": true
|
||||||
|
}
|
11
spec/mock_json/page/blocked.json
Normal file
11
spec/mock_json/page/blocked.json
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
{
|
||||||
|
"data": [
|
||||||
|
{
|
||||||
|
"name": "Jr Nov",
|
||||||
|
"id": "1575327134"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"paging": {
|
||||||
|
"next": "https://graph.facebook.com/v2.0/117513961602338/blocked?limit=5000&offset=5000&__after_id=enc_AewU3hSo5zqbS5KA0i0lJYmPrLn57SMSo645aYB7BTPg1PSawPvlM9mRI_3Y_dcpeDI"
|
||||||
|
}
|
||||||
|
}
|
19
spec/mock_json/page/milestones.json
Normal file
19
spec/mock_json/page/milestones.json
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
{
|
||||||
|
"data": [{
|
||||||
|
"id": "546071975451512",
|
||||||
|
"created_time": "2013-07-05T02:04:43+0000",
|
||||||
|
"description": "Big Guest from MIT-KIT",
|
||||||
|
"end_time": "2013-06-26T19:00:00+0000",
|
||||||
|
"from": {
|
||||||
|
"category": "Community",
|
||||||
|
"name": "Identity Conference #idcon",
|
||||||
|
"id": "367989543259757"
|
||||||
|
},
|
||||||
|
"start_time": "2013-06-26T19:00:00+0000",
|
||||||
|
"title": "idcon satellite",
|
||||||
|
"updated_time": "2013-07-05T02:04:43+0000"
|
||||||
|
}],
|
||||||
|
"paging": {
|
||||||
|
"next": "https://graph.facebook.com/v2.0/367989543259757/milestones?limit=5000&offset=5000&__after_id=enc_Aex6DrtZcpP_AZjou_LFSynIQJzuO-LR4zoj2GU-WQO3StnFciL5I6GVJ2Nlj5-6C50JJSpZnn5O-zkuPXcU4DAC"
|
||||||
|
}
|
||||||
|
}
|
67
spec/mock_json/page/promotable_posts.json
Normal file
67
spec/mock_json/page/promotable_posts.json
Normal file
|
@ -0,0 +1,67 @@
|
||||||
|
{
|
||||||
|
"data": [{
|
||||||
|
"id": "140478125968442_881790788503835",
|
||||||
|
"from": {
|
||||||
|
"category": "Community organization",
|
||||||
|
"name": "OAuth.jp",
|
||||||
|
"id": "140478125968442"
|
||||||
|
},
|
||||||
|
"story": "OAuth.jp shared a link.",
|
||||||
|
"story_tags": {
|
||||||
|
"0": [{
|
||||||
|
"id": "140478125968442",
|
||||||
|
"name": "OAuth.jp",
|
||||||
|
"offset": 0,
|
||||||
|
"length": 8,
|
||||||
|
"type": "page"
|
||||||
|
}]
|
||||||
|
},
|
||||||
|
"link": "http://oauth.jp/blog/2014/05/09/what-happens-when-oauth2-code-leaked/",
|
||||||
|
"name": "OAuth 2.0 の code は漏れても大丈夫ってホント!? - OAuth.jp",
|
||||||
|
"caption": "oauth.jp",
|
||||||
|
"description": "昨日のCovert Redirect で Query 漏れるケースもある!?やOAuth 2.0 の脆弱性 (!?) “Covert Redirect” とはにあるように、OAuth 2.0 の code が漏れちゃうことも、ありえます。 漏れないためにやるべきことは、 …",
|
||||||
|
"icon": "https://fbstatic-a.akamaihd.net/rsrc.php/v2/yD/r/aS8ecmYRys0.gif",
|
||||||
|
"actions": [{
|
||||||
|
"name": "Comment",
|
||||||
|
"link": "https://www.facebook.com/140478125968442/posts/881790788503835"
|
||||||
|
}, {
|
||||||
|
"name": "Like",
|
||||||
|
"link": "https://www.facebook.com/140478125968442/posts/881790788503835"
|
||||||
|
}],
|
||||||
|
"privacy": {
|
||||||
|
"description": "Public",
|
||||||
|
"value": "EVERYONE",
|
||||||
|
"friends": "",
|
||||||
|
"networks": "",
|
||||||
|
"allow": "",
|
||||||
|
"deny": ""
|
||||||
|
},
|
||||||
|
"type": "link",
|
||||||
|
"status_type": "shared_story",
|
||||||
|
"created_time": "2014-05-09T02:18:54+0000",
|
||||||
|
"updated_time": "2014-05-09T02:18:54+0000",
|
||||||
|
"is_published": true,
|
||||||
|
"likes": {
|
||||||
|
"data": [{
|
||||||
|
"id": "799980330042786",
|
||||||
|
"name": "Nobuyuki Tetsuka"
|
||||||
|
}, {
|
||||||
|
"id": "671955032839764",
|
||||||
|
"name": "Naohiro Fujie"
|
||||||
|
}, {
|
||||||
|
"id": "514441882016076",
|
||||||
|
"name": "Shouji Ohara"
|
||||||
|
}],
|
||||||
|
"paging": {
|
||||||
|
"cursors": {
|
||||||
|
"after": "NTE0NDQxODgyMDE2MDc2",
|
||||||
|
"before": "Nzk5OTgwMzMwMDQyNzg2"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}],
|
||||||
|
"paging": {
|
||||||
|
"previous": "https://graph.facebook.com/v2.0/140478125968442/promotable_posts?limit=25&since=1399601934",
|
||||||
|
"next": "https://graph.facebook.com/v2.0/140478125968442/promotable_posts?limit=25&until=1340970652"
|
||||||
|
}
|
||||||
|
}
|
36
spec/mock_json/user/activities.json
Normal file
36
spec/mock_json/user/activities.json
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
{
|
||||||
|
"data": [{
|
||||||
|
"category": "Interest",
|
||||||
|
"name": "Mobile Hack Tokyo",
|
||||||
|
"created_time": "2012-03-01T00:30:09+0000",
|
||||||
|
"id": "253431701402959"
|
||||||
|
}, {
|
||||||
|
"category": "Software",
|
||||||
|
"name": "Rack::OAuth2",
|
||||||
|
"created_time": "2011-06-23T10:32:47+0000",
|
||||||
|
"id": "141477809244105"
|
||||||
|
}, {
|
||||||
|
"category": "Non-profit organization",
|
||||||
|
"name": "OpenID Foundation Japan",
|
||||||
|
"created_time": "2011-06-23T04:53:40+0000",
|
||||||
|
"id": "157574337644417"
|
||||||
|
}, {
|
||||||
|
"category": "Internet/software",
|
||||||
|
"name": "SocialWeb Japan",
|
||||||
|
"created_time": "2011-04-26T04:54:13+0000",
|
||||||
|
"id": "150730961633"
|
||||||
|
}, {
|
||||||
|
"category": "Community organization",
|
||||||
|
"name": "OAuth.jp",
|
||||||
|
"created_time": "2011-01-05T00:27:02+0000",
|
||||||
|
"id": "140478125968442"
|
||||||
|
}, {
|
||||||
|
"category": "Software",
|
||||||
|
"name": "FbGraph",
|
||||||
|
"created_time": "2010-04-30T06:48:21+0000",
|
||||||
|
"id": "117513961602338"
|
||||||
|
}],
|
||||||
|
"paging": {
|
||||||
|
"next": "https://graph.facebook.com/v2.0/579612276/activities?limit=25&offset=25&__after_id=enc_AewISXs8Uhe2pwegtVsWC8GFmzAWEKKFzGcJoZ-UJa4MA_wFfCIRKFaQMJkS6U5WTdiSKw3G3EvlyDir1upNCBop"
|
||||||
|
}
|
||||||
|
}
|
23
spec/mock_json/user/albums.json
Normal file
23
spec/mock_json/user/albums.json
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
{
|
||||||
|
"data": [{
|
||||||
|
"id": "532912916729105",
|
||||||
|
"from": {
|
||||||
|
"category": "Software",
|
||||||
|
"name": "FbGraph",
|
||||||
|
"id": "117513961602338"
|
||||||
|
},
|
||||||
|
"name": "Timeline Photos",
|
||||||
|
"link": "https://www.facebook.com/album.php?fbid=532912916729105&id=117513961602338&aid=116544",
|
||||||
|
"privacy": "everyone",
|
||||||
|
"type": "wall",
|
||||||
|
"created_time": "2013-02-16T13:23:10+0000",
|
||||||
|
"updated_time": "2013-02-16T13:23:10+0000",
|
||||||
|
"can_upload": false
|
||||||
|
}],
|
||||||
|
"paging": {
|
||||||
|
"cursors": {
|
||||||
|
"after": "MjEwNDcxNDkyMzA2NTg0",
|
||||||
|
"before": "NTMyOTEyOTE2NzI5MTA1"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
16
spec/mock_json/user/events.json
Normal file
16
spec/mock_json/user/events.json
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
{
|
||||||
|
"data": [
|
||||||
|
{
|
||||||
|
"name": "Test Event",
|
||||||
|
"start_time": "2014-06-13T19:00:00+0900",
|
||||||
|
"timezone": "Asia/Tokyo",
|
||||||
|
"location": "六本木",
|
||||||
|
"rsvp_status": "attending",
|
||||||
|
"id": "246996708819160"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"paging": {
|
||||||
|
"previous": "https://graph.facebook.com/v2.0/579612276/events?limit=25&since=1402653600&__paging_token=enc_AezFmlDRX4GTGnTULSAcMS7GEDiK296BwTlhQLHgty6ocPG7F6tHzNZgysABJrSyXW0Xxv4A9f87zl1ii9B02tZ7",
|
||||||
|
"next": "https://graph.facebook.com/v2.0/579612276/events?limit=25&until=1402653600&__paging_token=enc_AexwobcxwDuR9BhmbM29GnNdQn7phvKIQGLtI-NeCFjlSP3uU6NeNGi10PTwl64OrNADgtn8PBNbJDsRwXGV1dg_"
|
||||||
|
}
|
||||||
|
}
|
18
spec/mock_json/user/friends.json
Normal file
18
spec/mock_json/user/friends.json
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
{
|
||||||
|
"data": [{
|
||||||
|
"name": "Nat Sakimura",
|
||||||
|
"id": "1048138174"
|
||||||
|
}, {
|
||||||
|
"name": "Yusuke Kondo",
|
||||||
|
"id": "1229826130"
|
||||||
|
}, {
|
||||||
|
"name": "Yuya Ito",
|
||||||
|
"id": "1326792131"
|
||||||
|
}, {
|
||||||
|
"name": "Tatsuya Katsuhara",
|
||||||
|
"id": "1784765822"
|
||||||
|
}],
|
||||||
|
"paging": {
|
||||||
|
"next": "https://graph.facebook.com/v2.0/579612276/friends?limit=5000&offset=5000&__after_id=enc_AexFQ6mn3PA35psWD5WjFNzW7ovDp35_gkApd8tXqRmc5ygEBBAEs56d3YIetOc9NNk"
|
||||||
|
}
|
||||||
|
}
|
16
spec/mock_json/user/groups.json
Normal file
16
spec/mock_json/user/groups.json
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
{
|
||||||
|
"data": [{
|
||||||
|
"name": "OpenID Connect Hackathon",
|
||||||
|
"administrator": true,
|
||||||
|
"bookmark_order": 14,
|
||||||
|
"id": "562322927125681"
|
||||||
|
}, {
|
||||||
|
"name": "OAuth.jp",
|
||||||
|
"administrator": true,
|
||||||
|
"bookmark_order": 12,
|
||||||
|
"id": "343659285716553"
|
||||||
|
}],
|
||||||
|
"paging": {
|
||||||
|
"next": "https://graph.facebook.com/v2.0/579612276/groups?icon_size=16&limit=5000&offset=5000&__after_id=enc_AeynOYwetNSbegZQTbjirpNPayS9oqujy9wnu0CnNjC7YMl4zxLq-JP--CRz3FX3KWg"
|
||||||
|
}
|
||||||
|
}
|
61
spec/mock_json/user/home.json
Normal file
61
spec/mock_json/user/home.json
Normal file
|
@ -0,0 +1,61 @@
|
||||||
|
{
|
||||||
|
"data": [{
|
||||||
|
"id": "114870808553071_759907394049406",
|
||||||
|
"from": {
|
||||||
|
"category": "Computers/internet website",
|
||||||
|
"name": "TechCrunch Japan",
|
||||||
|
"id": "114870808553071"
|
||||||
|
},
|
||||||
|
"story": "TechCrunch Japan shared a link.",
|
||||||
|
"story_tags": {
|
||||||
|
"0": [{
|
||||||
|
"id": "114870808553071",
|
||||||
|
"name": "TechCrunch Japan",
|
||||||
|
"offset": 0,
|
||||||
|
"length": 16,
|
||||||
|
"type": "page"
|
||||||
|
}]
|
||||||
|
},
|
||||||
|
"picture": "https://fbexternal-a.akamaihd.net/safe_image.php?d=AQCP3uH6kEoLnPsL&w=154&h=154&url=http%3A%2F%2Ftechcrunchjp.files.wordpress.com%2F2014%2F06%2F140603modiva1.jpg%3Fw%3D1024%26h%3D768",
|
||||||
|
"link": "http://dlvr.it/5sP8LX",
|
||||||
|
"name": "MOVIDA JAPANがデモデイを開催して13社が登壇‒‒個人的にはEigooo!に期待",
|
||||||
|
"caption": "jp.techcrunch.com",
|
||||||
|
"description": "MOVIDA JAPANは6月3日、同社のシードアクセラレーションプログラムの成果を発表する「MOVIDA JAPAN DemoDay 5th」を開催した。今回登壇したスタートアップは13社。まずは登壇したスタートアップとそのサービス概要を紹介していく。…",
|
||||||
|
"icon": "https://fbstatic-a.akamaihd.net/rsrc.php/v2/y5/r/sXJx2UP7quc.png",
|
||||||
|
"actions": [{
|
||||||
|
"name": "Comment",
|
||||||
|
"link": "https://www.facebook.com/114870808553071/posts/759907394049406"
|
||||||
|
}, {
|
||||||
|
"name": "Like",
|
||||||
|
"link": "https://www.facebook.com/114870808553071/posts/759907394049406"
|
||||||
|
}],
|
||||||
|
"privacy": {
|
||||||
|
"value": ""
|
||||||
|
},
|
||||||
|
"type": "link",
|
||||||
|
"status_type": "shared_story",
|
||||||
|
"application": {
|
||||||
|
"name": "dlvr.it",
|
||||||
|
"namespace": "dlvr_it",
|
||||||
|
"id": "232775914688"
|
||||||
|
},
|
||||||
|
"created_time": "2014-06-03T08:20:01+0000",
|
||||||
|
"updated_time": "2014-06-03T08:20:01+0000",
|
||||||
|
"likes": {
|
||||||
|
"data": [{
|
||||||
|
"id": "10203763563950799",
|
||||||
|
"name": "Takuya Kawai"
|
||||||
|
}],
|
||||||
|
"paging": {
|
||||||
|
"cursors": {
|
||||||
|
"after": "MTAyMDM3NjM1NjM5NTA3OTk=",
|
||||||
|
"before": "MTAyMDM3NjM1NjM5NTA3OTk="
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}],
|
||||||
|
"paging": {
|
||||||
|
"previous": "https://graph.facebook.com/v2.0/579612276/home?limit=25&since=1401784697",
|
||||||
|
"next": "https://graph.facebook.com/v2.0/579612276/home?limit=25&until=1401773525"
|
||||||
|
}
|
||||||
|
}
|
27
spec/mock_json/user/invitable_friends.json
Normal file
27
spec/mock_json/user/invitable_friends.json
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
{
|
||||||
|
"data": [{
|
||||||
|
"id": "AVm6afobc20T0wATmCYRk_CNymo_44MQW8yMBwpgDFAQ18iF9feZpDEDmwfmcjSBSSuYkFfD5fx77g_uJRF0fmQ7AR2kObX8biP4wzN7UMpbYQ",
|
||||||
|
"name": "Shingo Yamanaka",
|
||||||
|
"picture": {
|
||||||
|
"data": {
|
||||||
|
"is_silhouette": false,
|
||||||
|
"url": "https://fbcdn-profile-a.akamaihd.net/hprofile-ak-xpf1/t1.0-1/c0.15.85.85/s50x50/1468668_10152037195781416_2050550170_s.jpg"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
"id": "AVnJiIlmAtrWJ106ErRPlLZNy8_Hd4mfmuQBrbGm4tuFS_ENvyYdVxTwgesXE5Wp2ICtxcPHzkA4Y4BJAWwJqyUie2ZDKQeKn9mnjPCVAUr8Lg",
|
||||||
|
"name": "Hayashi Tatsuya",
|
||||||
|
"picture": {
|
||||||
|
"data": {
|
||||||
|
"is_silhouette": false,
|
||||||
|
"url": "https://fbcdn-profile-a.akamaihd.net/hprofile-ak-xaf1/t1.0-1/c79.38.479.479/s50x50/388771_10150501378984825_523522119_n.jpg"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}],
|
||||||
|
"paging": {
|
||||||
|
"cursors": {
|
||||||
|
"before": "QVZra09GaExkNndsM1J5eVpuQ2dWS1hLV3FBb0dqRTh3dC1PVXJIZE8ya0JzbV9kUDZXcWZEdUtUZFNHejcxeGlWZ3JjZjZjdkIwMWdtSWtHZGpGVE8wTWZ5cUdNUm5NWWw3c2hSTEtPZ19ySmc=",
|
||||||
|
"after": "QVZrdlNsUHItNExPY1JIUVdlZ3BDZlFCTHFFMUl6YVhnVG5fRVlBLVV0QThUMFBmRnZNQkVQWVg2VkRBQWhRa3RyemVQUFhscWxBVERYZU15SExZbG50Z0RTQUtfVno5VjRjT3VUb2J5NGg1VFE="
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
114
spec/mock_json/user/permissions.json
Normal file
114
spec/mock_json/user/permissions.json
Normal file
|
@ -0,0 +1,114 @@
|
||||||
|
{
|
||||||
|
"data": [{
|
||||||
|
"permission": "installed",
|
||||||
|
"status": "granted"
|
||||||
|
}, {
|
||||||
|
"permission": "public_profile",
|
||||||
|
"status": "granted"
|
||||||
|
}, {
|
||||||
|
"permission": "read_stream",
|
||||||
|
"status": "granted"
|
||||||
|
}, {
|
||||||
|
"permission": "read_mailbox",
|
||||||
|
"status": "granted"
|
||||||
|
}, {
|
||||||
|
"permission": "read_page_mailboxes",
|
||||||
|
"status": "granted"
|
||||||
|
}, {
|
||||||
|
"permission": "rsvp_event",
|
||||||
|
"status": "granted"
|
||||||
|
}, {
|
||||||
|
"permission": "email",
|
||||||
|
"status": "granted"
|
||||||
|
}, {
|
||||||
|
"permission": "read_insights",
|
||||||
|
"status": "granted"
|
||||||
|
}, {
|
||||||
|
"permission": "manage_notifications",
|
||||||
|
"status": "granted"
|
||||||
|
}, {
|
||||||
|
"permission": "read_friendlists",
|
||||||
|
"status": "granted"
|
||||||
|
}, {
|
||||||
|
"permission": "manage_pages",
|
||||||
|
"status": "granted"
|
||||||
|
}, {
|
||||||
|
"permission": "publish_actions",
|
||||||
|
"status": "granted"
|
||||||
|
}, {
|
||||||
|
"permission": "user_birthday",
|
||||||
|
"status": "granted"
|
||||||
|
}, {
|
||||||
|
"permission": "user_religion_politics",
|
||||||
|
"status": "granted"
|
||||||
|
}, {
|
||||||
|
"permission": "user_relationships",
|
||||||
|
"status": "granted"
|
||||||
|
}, {
|
||||||
|
"permission": "user_relationship_details",
|
||||||
|
"status": "granted"
|
||||||
|
}, {
|
||||||
|
"permission": "user_hometown",
|
||||||
|
"status": "granted"
|
||||||
|
}, {
|
||||||
|
"permission": "user_location",
|
||||||
|
"status": "granted"
|
||||||
|
}, {
|
||||||
|
"permission": "user_likes",
|
||||||
|
"status": "granted"
|
||||||
|
}, {
|
||||||
|
"permission": "user_activities",
|
||||||
|
"status": "granted"
|
||||||
|
}, {
|
||||||
|
"permission": "user_interests",
|
||||||
|
"status": "granted"
|
||||||
|
}, {
|
||||||
|
"permission": "user_education_history",
|
||||||
|
"status": "granted"
|
||||||
|
}, {
|
||||||
|
"permission": "user_work_history",
|
||||||
|
"status": "granted"
|
||||||
|
}, {
|
||||||
|
"permission": "user_website",
|
||||||
|
"status": "granted"
|
||||||
|
}, {
|
||||||
|
"permission": "user_groups",
|
||||||
|
"status": "granted"
|
||||||
|
}, {
|
||||||
|
"permission": "user_events",
|
||||||
|
"status": "granted"
|
||||||
|
}, {
|
||||||
|
"permission": "user_photos",
|
||||||
|
"status": "granted"
|
||||||
|
}, {
|
||||||
|
"permission": "user_videos",
|
||||||
|
"status": "granted"
|
||||||
|
}, {
|
||||||
|
"permission": "user_friends",
|
||||||
|
"status": "granted"
|
||||||
|
}, {
|
||||||
|
"permission": "user_about_me",
|
||||||
|
"status": "granted"
|
||||||
|
}, {
|
||||||
|
"permission": "user_status",
|
||||||
|
"status": "granted"
|
||||||
|
}, {
|
||||||
|
"permission": "user_games_activity",
|
||||||
|
"status": "granted"
|
||||||
|
}, {
|
||||||
|
"permission": "user_tagged_places",
|
||||||
|
"status": "granted"
|
||||||
|
}, {
|
||||||
|
"permission": "user_actions.books",
|
||||||
|
"status": "granted"
|
||||||
|
}, {
|
||||||
|
"permission": "user_actions.music",
|
||||||
|
"status": "granted"
|
||||||
|
}, {
|
||||||
|
"permission": "user_actions.video",
|
||||||
|
"status": "granted"
|
||||||
|
}, {
|
||||||
|
"permission": "user_actions.news",
|
||||||
|
"status": "granted"
|
||||||
|
}]
|
||||||
|
}
|
6
spec/mock_json/user/picture.json
Normal file
6
spec/mock_json/user/picture.json
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"data": {
|
||||||
|
"url": "https://fbcdn-profile-a.akamaihd.net/hprofile-ak-xfp1/t1.0-1/p50x50/1621886_836472406369007_1319645706_t.jpg",
|
||||||
|
"is_silhouette": false
|
||||||
|
}
|
||||||
|
}
|
14
spec/mock_json/user/scores.json
Normal file
14
spec/mock_json/user/scores.json
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
{
|
||||||
|
"data": [{
|
||||||
|
"user": {
|
||||||
|
"id": "10152411392127277",
|
||||||
|
"name": "Nov Matake"
|
||||||
|
},
|
||||||
|
"score": 10,
|
||||||
|
"application": {
|
||||||
|
"name": "gem sample",
|
||||||
|
"namespace": "fbgraphsample",
|
||||||
|
"id": "134145643294322"
|
||||||
|
}
|
||||||
|
}]
|
||||||
|
}
|
41
spec/mock_json/user/videos.json
Normal file
41
spec/mock_json/user/videos.json
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
{
|
||||||
|
"data": [{
|
||||||
|
"id": "10150407695537277",
|
||||||
|
"from": {
|
||||||
|
"category": "Software",
|
||||||
|
"name": "FbGraph",
|
||||||
|
"id": "117513961602338"
|
||||||
|
},
|
||||||
|
"name": "Testing Video Upload!",
|
||||||
|
"description": "Testing Video Upload!!!!",
|
||||||
|
"picture": "https://fbcdn-vthumb-a.akamaihd.net/hvthumb-ak-xap1/t15.0-10/51203_10150407695802277_10150407695537277_13346_258_t.jpg",
|
||||||
|
"embed_html": "<iframe src=\"https://www.facebook.com/video/embed?video_id=10150407695537277\" width=\"640\" height=\"480\" frameborder=\"0\"></iframe>",
|
||||||
|
"icon": "https://fbstatic-a.akamaihd.net/rsrc.php/v2/yD/r/DggDhA4z4tO.gif",
|
||||||
|
"source": "https://fbcdn-video-a.akamaihd.net/hvideo-ak-xap1/v/t43.1792-2/1205675_10151804645367277_61538_n.mp4?oh=d78d7d5854d1614376ca0358b15b9f54&oe=538F750B&__gda__=1401907382_f5c3b44cfea781601e4caed9eca55002",
|
||||||
|
"created_time": "2011-11-09T08:31:28+0000",
|
||||||
|
"updated_time": "2011-11-09T08:31:28+0000",
|
||||||
|
"format": [{
|
||||||
|
"embed_html": "<iframe src=\"https://www.facebook.com/video/embed?video_id=10150407695537277\" width=\"130\" height=\"98\" frameborder=\"0\"></iframe>",
|
||||||
|
"width": 130,
|
||||||
|
"height": 98,
|
||||||
|
"filter": "130x130",
|
||||||
|
"picture": "https://fbcdn-vthumb-a.akamaihd.net/hvthumb-ak-xap1/t15.0-10/s130x130/51203_10150407695802277_10150407695537277_13346_258_t.jpg"
|
||||||
|
}, {
|
||||||
|
"embed_html": "<iframe src=\"https://www.facebook.com/video/embed?video_id=10150407695537277\" width=\"480\" height=\"360\" frameborder=\"0\"></iframe>",
|
||||||
|
"width": 480,
|
||||||
|
"height": 360,
|
||||||
|
"filter": "480x480",
|
||||||
|
"picture": "https://fbcdn-vthumb-a.akamaihd.net/hvthumb-ak-xap1/t15.0-10/s480x480/51203_10150407695802277_10150407695537277_13346_258_b.jpg"
|
||||||
|
}, {
|
||||||
|
"embed_html": "<iframe src=\"https://www.facebook.com/video/embed?video_id=10150407695537277\" width=\"640\" height=\"480\" frameborder=\"0\"></iframe>",
|
||||||
|
"width": 640,
|
||||||
|
"height": 480,
|
||||||
|
"filter": "native",
|
||||||
|
"picture": "https://fbcdn-vthumb-a.akamaihd.net/hvthumb-ak-xap1/t15.0-10/51203_10150407695802277_10150407695537277_13346_258_b.jpg"
|
||||||
|
}]
|
||||||
|
}],
|
||||||
|
"paging": {
|
||||||
|
"previous": "https://graph.facebook.com/v2.0/117513961602338/videos?limit=25&since=1320827488",
|
||||||
|
"next": "https://graph.facebook.com/v2.0/117513961602338/videos?limit=25&until=1308369661"
|
||||||
|
}
|
||||||
|
}
|
|
@ -5,8 +5,15 @@ SimpleCov.start do
|
||||||
end
|
end
|
||||||
|
|
||||||
require 'rspec'
|
require 'rspec'
|
||||||
|
require 'rspec/its'
|
||||||
require 'fb_graph2'
|
require 'fb_graph2'
|
||||||
|
|
||||||
|
RSpec.configure do |config|
|
||||||
|
config.expect_with :rspec do |c|
|
||||||
|
c.syntax = [:should, :expect]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
Dir[File.join(__dir__, 'spec_helper/*.rb')].each do |file|
|
Dir[File.join(__dir__, 'spec_helper/*.rb')].each do |file|
|
||||||
require file
|
require file
|
||||||
end
|
end
|
|
@ -50,7 +50,7 @@ module MockGraph
|
||||||
end
|
end
|
||||||
if options[:params]
|
if options[:params]
|
||||||
case method
|
case method
|
||||||
when :post, :put
|
when :post, :put, :delete
|
||||||
request[:body] = options[:params]
|
request[:body] = options[:params]
|
||||||
else
|
else
|
||||||
request[:query] = options[:params]
|
request[:query] = options[:params]
|
||||||
|
|
Loading…
Reference in a new issue