Bump gem version and fix current_facebook_user

This commit is contained in:
Mike Mangino 2010-05-06 10:13:56 -04:00
parent 6f52778c38
commit 674b45135a
5 changed files with 13 additions and 3 deletions

View File

@ -1,6 +1,6 @@
spec = Gem::Specification.new do |s|
s.name = 'facebooker2'
s.version = '0.0.1'
s.version = '0.0.2'
s.summary = "Facebook Connect integration library for ruby and rails"
s.description = "Facebook Connect integration library for ruby and rails"
s.files = Dir['lib/**/*.rb']

View File

@ -34,6 +34,7 @@ module Facebooker2
end
def fb_sign_in_user_and_client(user,client)
user.client = client
@_current_facebook_user = user
@_current_facebook_client = client
@_fb_user_fetched = true

View File

@ -2,7 +2,7 @@ module Facebooker2
module Rails
module Helpers
module Javascript
def fb_connect_async_js(app_id,options={})
def fb_connect_async_js(app_id=Facebooker2.app_id,options={})
opts = Hash.new(true).merge!(options)
cookie = opts[:cookie]
status = opts[:status]

View File

@ -11,6 +11,11 @@ describe Facebooker2::Rails::Helpers::FacebookConnect, :type=>:helper do
fb_login_and_redirect("/",:text=>"my test").should ==
"<fb:login-button onlogin=\"window.location.href = &quot;/&quot;;\">my test</fb:login-button>"
end
it "allows you to specify the permissions" do
fb_login_and_redirect("/",:perms=>"email,offline_access").should ==
"<fb:login-button onlogin=\"window.location.href = &quot;/&quot;;\" perms=\"email,offline_access\"></fb:login-button>"
end
end
describe "Logging out" do

View File

@ -42,6 +42,10 @@ describe Facebooker2::Rails::Controller do
controller.current_facebook_user.id.should == "12451752"
end
it "sets the client for the user" do
controller.current_facebook_user.client.access_token.should == "114355055262088|57f0206b01ad48bf84ac86f1-12451752|63WyZjRQbzowpN8ibdIfrsg80OA."
end
it "doesn't create a user if there is no app cookie" do
Facebooker2.app_id="other_app"
controller.current_facebook_user.should be_nil
@ -87,7 +91,7 @@ describe Facebooker2::Rails::Controller do
controller.fb_sign_in_user_and_client(Mogli::User.new,Mogli::Client.new)
end
it "has a current_facebook_user" do
user = mock("user")
user = mock("user",:client= => nil)
controller.fb_sign_in_user_and_client(user,Mogli::Client.new)
controller.current_facebook_user.should == user
end