Skip to content
Browse files

Added rescue for expired facebook cookies.

  • Loading branch information...
1 parent 907e892 commit 6667894d34a8a3c2697479cd66423feee03140fe @james2m committed Dec 14, 2011
View
3 lib/authlogic_facebook_shim/adapters/koala_adapter.rb
@@ -12,7 +12,8 @@ def facebook_session
user_info = oauth.get_user_from_cookie(controller.cookies)
end
OpenStruct.new( user_info ) if user_info
-
+ rescue Koala::Facebook::APIError
+ nil
end
end
View
13 test/units/adapters/koala_adapter_test.rb
@@ -148,6 +148,19 @@
end
+ describe "with expired facebook cookie" do
+
+ before do
+ @oauth.expect :respond_to?, :true, [:get_user_info_from_cookie]
+ override @oauth, :get_user_info_from_cookie => lambda { |cookies| raise Koala::Facebook::APIError.new('expired') }
+ end
+
+ it "should return nil" do
+ @session.facebook_session.must_be_nil
+ end
+
+ end
+
end
describe "facebook_session?" do

0 comments on commit 6667894

Please sign in to comment.
Something went wrong with that request. Please try again.