Sha256: 5bc2213bd8d7c0acc38705d4751b89407aa87e264e814fd94835bdc920ac341a

Contents?: true

Size: 1.31 KB

Versions: 18

Compression:

Stored size: 1.31 KB

Contents

require File.join(File.dirname(__FILE__), '../spec_helper')

describe FbGraph::TestUser, '.new' do

  it 'should setup all supported attributes' do
    attributes = {
      :id => 12345,
      :access_token => 'access_token',
      :login_url => 'https://www.facebook.com/login/test-user/12345'
    }
    test_user = FbGraph::TestUser.new(attributes.delete(:id), attributes)
    test_user.login_url.should == 'https://www.facebook.com/login/test-user/12345'
  end

end

describe FbGraph::TestUser, '.friend!' do

  before do
    @u1 = FbGraph::TestUser.new(111, :access_token => 'token1')
    @u2 = FbGraph::TestUser.new(222, :access_token => 'token2')
  end

  it 'should POST twice' do
    lambda do
      @u1.friend! @u2
    end.should request_to('111/friends/222', :post)
    fake_json(:post, '111/friends/222', 'true')
    lambda do
      @u1.friend! @u2
    end.should request_to('222/friends/111', :post)
    fake_json(:post, '222/friends/111', 'true')
    lambda do
      @u1.friend! @u2
    end.should_not raise_error(FakeWeb::NetConnectNotAllowedError)
  end

end

describe FbGraph::TestUser, '.destroy' do
  before do
    @user = FbGraph::TestUser.new(111, :access_token => 'token1')
  end

  it 'should DELETE /user_id' do
    lambda do
      @user.destroy
    end.should request_to('111?access_token=token1', :delete)
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
fb_graph-1.5.3 spec/fb_graph/test_user_spec.rb
fb_graph-1.5.2 spec/fb_graph/test_user_spec.rb
fb_graph-1.5.1 spec/fb_graph/test_user_spec.rb
fb_graph-1.5.0 spec/fb_graph/test_user_spec.rb
fb_graph-1.4.1 spec/fb_graph/test_user_spec.rb
fb_graph-1.4.0 spec/fb_graph/test_user_spec.rb
fb_graph-1.3.9 spec/fb_graph/test_user_spec.rb
fb_graph-1.3.8 spec/fb_graph/test_user_spec.rb
fb_graph-1.3.7 spec/fb_graph/test_user_spec.rb
fb_graph-1.3.6 spec/fb_graph/test_user_spec.rb
fb_graph-1.3.5 spec/fb_graph/test_user_spec.rb
fb_graph-1.3.4 spec/fb_graph/test_user_spec.rb
fb_graph-1.3.3 spec/fb_graph/test_user_spec.rb
fb_graph-1.3.2 spec/fb_graph/test_user_spec.rb
fb_graph-1.3.1 spec/fb_graph/test_user_spec.rb
fb_graph-1.3.0 spec/fb_graph/test_user_spec.rb
fb_graph-1.2.5 spec/fb_graph/test_user_spec.rb
fb_graph-1.2.4 spec/fb_graph/test_user_spec.rb