1
0
Fork 0
mirror of https://github.com/nov/fb_graph2 synced 2023-03-27 23:22:15 -04:00

feed spec

This commit is contained in:
nov 2014-05-21 18:20:41 +09:00
parent 7659c630a5
commit 1b764ffa81
4 changed files with 30 additions and 3 deletions

View file

@ -5,7 +5,7 @@ describe FbGraph2::Edge::Accounts do
describe '#accounts' do
let(:me) { FbGraph2::User.me('token') }
it 'should return pages with page token' do
accounts = mock_graph :get, 'me/accounts', 'user/accounts' do
accounts = mock_graph :get, 'me/accounts', 'user/accounts', access_token: 'token' do
me.accounts
end
account = accounts.first

View file

@ -0,0 +1,22 @@
require 'spec_helper'
describe FbGraph2::Edge::Feed do
context 'included in User' do
let(:me) { FbGraph2::User.me('token') }
describe '#feed' do
it :TODO
end
describe 'feed!' do
it 'should return FbGraph2::Post with posted params' do
post = mock_graph :post, 'me/feed', 'success_with_id', access_token: 'token' do
me.feed! message: 'hello'
end
post.should be_instance_of FbGraph2::Post
post.id.should == 'created_object_id'
post.message.should == 'hello'
end
end
end
end

View file

@ -0,0 +1,3 @@
{
"id": "created_object_id"
}

View file

@ -39,8 +39,10 @@ module MockGraph
def request_for(method, options = {})
request = {}
if options[:access_token]
options[:params] ||= {}
options[:params][:access_token] = options[:access_token].to_s
request[:headers] ||= {}
request[:headers] = {
authorization: "Bearer #{options[:access_token]}"
}
end
if options[:params]
case method