Sha256: bd7470a54158dfe08b78a3b95c4a90d0b55bb582c33f8af3e1fbde4834bbf7a6

Contents?: true

Size: 1.48 KB

Versions: 10

Compression:

Stored size: 1.48 KB

Contents

require 'spec_helper'

describe FbGraph::Connections::TestUsers, '#test_users' do
  before do
    @app = FbGraph::Application.new('client_id', :secret => 'secret')
  end

  context 'when access_token is not given' do
    it 'should get access_token first' do
      lambda do
        @app.test_users
      end.should request_to('oauth/access_token', :post)
    end
  end

  context 'when access_token is given' do
    it 'should return test_users as FbGraph::TestUser' do
      mock_graph :get, 'client_id/accounts/test-users', 'applications/test_users/private', :access_token => 'access_token' do
        @app.access_token = 'access_token'
        test_users = @app.test_users
        test_users.each do |test_user|
          test_user.should be_instance_of(FbGraph::TestUser)
        end
      end
    end
  end
end

describe FbGraph::Connections::TestUsers, '#test_user!' do
  before do
    @app = FbGraph::Application.new('client_id', :secret => 'secret')
  end

  context 'when access_token is not given' do
    it 'should get access_token first' do
      lambda do
        @app.test_user!
      end.should request_to('oauth/access_token', :post)
    end
  end

  context 'when access_token is given' do
    it 'should return a FbGraph::TestUser' do
      mock_graph :post, 'client_id/accounts/test-users', 'applications/test_users/created' do
        @app.access_token = 'access_token'
        test_user = @app.test_user!
        test_user.should be_instance_of FbGraph::TestUser
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
fb_graph-1.9.0 spec/fb_graph/connections/test_users_spec.rb
fb_graph-1.8.6 spec/fb_graph/connections/test_users_spec.rb
fb_graph-1.8.5 spec/fb_graph/connections/test_users_spec.rb
fb_graph-1.8.4 spec/fb_graph/connections/test_users_spec.rb
fb_graph-1.8.3 spec/fb_graph/connections/test_users_spec.rb
fb_graph-1.8.2 spec/fb_graph/connections/test_users_spec.rb
fb_graph-1.8.1 spec/fb_graph/connections/test_users_spec.rb
fb_graph-1.8.0 spec/fb_graph/connections/test_users_spec.rb
fb_graph-1.8.0.alpha2 spec/fb_graph/connections/test_users_spec.rb
fb_graph-1.8.0.alpha spec/fb_graph/connections/test_users_spec.rb