Permalink
Browse files

Limit scope of changes, add test

  • Loading branch information...
1 parent 26b503b commit 5b4c0cb35a8a2b7f684ded3f1de3f98c2f4125aa andy committed Aug 31, 2011
Showing with 10 additions and 2 deletions.
  1. +1 −1 lib/mogli/authenticator.rb
  2. +9 −1 spec/authenticator_spec.rb
@@ -13,7 +13,7 @@ def initialize(client_id,secret,callback_url)
def authorize_url(options = {})
options_part = "&" + options.map {|k,v| "#{k}=#{v.kind_of?(Array) ? v.join(',') : v}" }.join('&') unless options.empty?
- "https://graph.facebook.com/oauth/authorize?client_id=#{client_id}&redirect_uri=#{CGI.escape(callback_url) if !callback_url.blank?}#{options_part}"
+ "https://graph.facebook.com/oauth/authorize?client_id=#{client_id}&redirect_uri=#{CGI.escape(callback_url)}#{options_part}"
end
def access_token_url(code)
View
@@ -1,6 +1,5 @@
require "spec_helper"
describe Mogli::Authenticator do
-
let :authenticator do
Mogli::Authenticator.new("123456","secret","http://example.com/url")
end
@@ -89,4 +88,13 @@
end
+ context "Oauth2" do
+ let :oauth2_authenticator do
+ Mogli::Authenticator.new("123456","secret",nil)
+ end
+ it "creates the access_token_url without a redirect URL" do
+ oauth2_authenticator.access_token_url("mycode").should == "https://graph.facebook.com/oauth/access_token?client_id=123456&redirect_uri=&client_secret=secret&code=mycode"
+ end
+ end
+
end

0 comments on commit 5b4c0cb

Please sign in to comment.