diff --git a/facebooker2.gemspec b/facebooker2.gemspec
index 234f941..d41e1ad 100644
--- a/facebooker2.gemspec
+++ b/facebooker2.gemspec
@@ -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']
diff --git a/lib/facebooker2/rails/controller.rb b/lib/facebooker2/rails/controller.rb
index c1e3755..aca695c 100644
--- a/lib/facebooker2/rails/controller.rb
+++ b/lib/facebooker2/rails/controller.rb
@@ -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
diff --git a/lib/facebooker2/rails/helpers/javascript.rb b/lib/facebooker2/rails/helpers/javascript.rb
index 6abf478..a7b28fe 100644
--- a/lib/facebooker2/rails/helpers/javascript.rb
+++ b/lib/facebooker2/rails/helpers/javascript.rb
@@ -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]
diff --git a/spec/helpers/facebook_connect_spec.rb b/spec/helpers/facebook_connect_spec.rb
index 49ac810..4b47b9d 100644
--- a/spec/helpers/facebook_connect_spec.rb
+++ b/spec/helpers/facebook_connect_spec.rb
@@ -11,6 +11,11 @@ describe Facebooker2::Rails::Helpers::FacebookConnect, :type=>:helper do
fb_login_and_redirect("/",:text=>"my test").should ==
"my test"
end
+
+ it "allows you to specify the permissions" do
+ fb_login_and_redirect("/",:perms=>"email,offline_access").should ==
+ ""
+ end
end
describe "Logging out" do
diff --git a/spec/rails/controller_spec.rb b/spec/rails/controller_spec.rb
index 707dfb9..09d28d8 100644
--- a/spec/rails/controller_spec.rb
+++ b/spec/rails/controller_spec.rb
@@ -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