Sha256: 440b34c6eb716d940f667c68a8e01646df4c856adf0812dfe4fed335a39a12f1

Contents?: true

Size: 1.19 KB

Versions: 1

Compression:

Stored size: 1.19 KB

Contents

# -*- coding: utf-8 -*-
require 'spec_helper'

describe FbGraph::Connections::Activities, '#activities' do
  context 'when included by FbGraph::User' do
    before do
      fake_json(:get, 'arjun/activities', 'users/activities/arjun_public', :status => [401, 'Unauthorized'])
      fake_json(:get, 'arjun/activities?access_token=access_token', 'users/activities/arjun_private')
    end

    context 'when no access_token given' do
      it 'should raise FbGraph::Unauthorized' do
        lambda do
          FbGraph::User.new('arjun').activities
        end.should raise_exception(FbGraph::Unauthorized)
      end
    end

    context 'when access_token is given' do
      it 'should return activities as FbGraph::Page' do
        activities = FbGraph::User.new('arjun', :access_token => 'access_token').activities
        activities.class.should == FbGraph::Connection
        activities.first.should == FbGraph::Page.new(
          '378209722137',
          :access_token => 'access_token',
          :name => 'Doing Things at the Last Minute',
          :category => '活動'
        )
        activities.each do |activity|
          activity.should be_instance_of(FbGraph::Page)
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fb_graph-1.7.1 spec/fb_graph/connections/activities_spec.rb