mirror of
				https://github.com/nov/fb_graph2
				synced 2023-03-27 23:22:15 -04:00 
			
		
		
		
	feed spec
This commit is contained in:
		
							parent
							
								
									7659c630a5
								
							
						
					
					
						commit
						1b764ffa81
					
				
					 4 changed files with 30 additions and 3 deletions
				
			
		| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										22
									
								
								spec/fb_graph2/edge/feed_spec.rb
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								spec/fb_graph2/edge/feed_spec.rb
									
										
									
									
									
										Normal 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
 | 
			
		||||
							
								
								
									
										3
									
								
								spec/mock_json/success_with_id.json
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								spec/mock_json/success_with_id.json
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,3 @@
 | 
			
		|||
{
 | 
			
		||||
  "id": "created_object_id"
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue