Skip to content

Commit

Permalink
add specs for FBGraph::Client
Browse files Browse the repository at this point in the history
  • Loading branch information
nsanta committed May 11, 2010
1 parent 0de9420 commit 53fde0f
Show file tree
Hide file tree
Showing 12 changed files with 121 additions and 12 deletions.
Empty file added README
Empty file.
File renamed without changes.
33 changes: 33 additions & 0 deletions fbgraph.gemspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# -*- encoding: utf-8 -*-

Gem::Specification.new do |s|
s.name = %q{fbgraph}
s.version = "0.0.4"

s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
s.authors = ["Nicolas Santa"]
s.date = %q{2010-05-11}
s.description = %q{A Gem for Facebook Open Graph API}
s.email = %q{nicolas55ar@gmail.com}
s.extra_rdoc_files = ["README", "lib/fbgraph.rb", "lib/fbgraph/authorization.rb", "lib/fbgraph/base.rb", "lib/fbgraph/client.rb", "lib/fbgraph/search.rb", "lib/fbgraph/selection.rb"]
s.files = ["README", "Rakefile", "lib/fbgraph.rb", "lib/fbgraph/authorization.rb", "lib/fbgraph/base.rb", "lib/fbgraph/client.rb", "lib/fbgraph/search.rb", "lib/fbgraph/selection.rb", "specs/lib/fbauth/authorization_spec.rb", "specs/lib/fbauth/base_spec.rb", "specs/lib/fbauth/search_spec.rb", "Manifest", "fbgraph.gemspec"]
s.homepage = %q{http://github.com/nsanta/fbgraph}
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Fbgraph", "--main", "README"]
s.require_paths = ["lib"]
s.rubyforge_project = %q{fbgraph}
s.rubygems_version = %q{1.3.6}
s.summary = %q{A Gem for Facebook Open Graph API}

if s.respond_to? :specification_version then
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
s.specification_version = 3

if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
s.add_development_dependency(%q<oauth2>, [">= 0"])
else
s.add_dependency(%q<oauth2>, [">= 0"])
end
else
s.add_dependency(%q<oauth2>, [">= 0"])
end
end
4 changes: 1 addition & 3 deletions lib/fbgraph.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,4 @@
require 'fbgraph/authorization'
require 'fbgraph/selection'
require 'fbgraph/search'
require 'fbgraph/realtime'


#require 'fbgraph/realtime'
6 changes: 3 additions & 3 deletions lib/fbgraph/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ def search
FBGraph::Search.new(self)
end

def realtime
FBGraph::Realtime.new(self)
end
# def realtime
# FBGraph::Realtime.new(self)
# end


def oauth_client
Expand Down
Binary file modified pkg/fbgraph-0.0.4.gem
Binary file not shown.
4 changes: 1 addition & 3 deletions pkg/fbgraph-0.0.4/lib/fbgraph.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,4 @@
require 'fbgraph/authorization'
require 'fbgraph/selection'
require 'fbgraph/search'
require 'fbgraph/realtime'


#require 'fbgraph/realtime'
6 changes: 3 additions & 3 deletions pkg/fbgraph-0.0.4/lib/fbgraph/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ def search
FBGraph::Search.new(self)
end

def realtime
FBGraph::Realtime.new(self)
end
# def realtime
# FBGraph::Realtime.new(self)
# end


def oauth_client
Expand Down
80 changes: 80 additions & 0 deletions specs/lib/fbauth/client_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
require File.join(File.dirname(__FILE__),"../../../lib/fbgraph")

describe FBGraph do
describe FBGraph::Client do
describe "initialization" do
before :each do
@client_id = 'client_id'
@secret_id = 'secret_id'
end
describe 'default' do

before :each do
@client = FBGraph::Client.new(:client_id => @client_id,
:secret_id => @secret_id)
end

it 'should set the client_id' do
@client.client_id.should == @client_id
end
it 'should set the secret_id' do
@client.secret_id.should == @secret_id
end
it 'should set the facebook_uri ' do
@client.facebook_uri.should == "https://graph.facebook.com"
end
end

describe 'when token is present' do
before :each do
@token = 'token'
@client = FBGraph::Client.new(:client_id => @client_id,
:secret_id => @secret_id,
:token => @token)
end

it 'should set the access_token' do
@client.access_token.should == @token
end
it 'should set the consumer client' do
@client.consumer.class.should == OAuth2::AccessToken
end
end
end


describe "instance methods" do
before :each do
@client_id = 'client_id'
@secret_id = 'secret_id'
@client = FBGraph::Client.new(:client_id => @client_id,
:secret_id => @secret_id)
end
describe '.authorization' do
it 'should return a FBGraph::Authorization object' do
@client.authorization.class.should == FBGraph::Authorization
end
end

describe '.selection' do
it 'should return a FBGraph::Selection object' do
@client.selection.class.should == FBGraph::Selection
end
end

describe '.search' do
it 'should return a FBGraph::Search object' do
@client.search.class.should == FBGraph::Search
end
end

describe '.realtime'

describe '.oauth_client' do
it 'should return a OAuth2::Client object' do
@client.oauth_client.class.should == OAuth2::Client
end
end
end
end
end
Empty file.
Empty file.
Empty file added specs/spec_helper.rb
Empty file.

0 comments on commit 53fde0f

Please sign in to comment.