Created
November 8, 2010 22:49
-
-
Save steveh/668416 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
When /^Facebook returns (.*)$/ do |returns| | |
Devise::OmniAuth.short_circuit_authorizers! | |
Devise::OmniAuth.stub!(:facebook) do |b| | |
access_token = { | |
:access_token => "plataformatec" | |
} | |
b.post('/oauth/access_token') { [200, {}, access_token.to_json] } | |
facebook = { | |
:id => '12345', | |
:link => 'http://facebook.com/user_example', | |
:email => '[email protected]', | |
:first_name => 'User', | |
:last_name => 'Example', | |
:website => 'http://blog.plataformatec.com.br' | |
} | |
b.get('https://graph.facebook.com/oauth/authorize?client_id=121291144597463&redirect_uri=http%3A%2F%2Fwww.example.com%2Fusers%2Fauth%2Ffacebook%2Fcallback&scope=email%2Coffline_access&type=web_server') { [200, {}, facebook.to_json] } | |
end | |
visit '/users/auth/facebook' | |
# hash = {} | |
# returns.split(/,\s+/).each do |part| | |
# if part =~ /([a-z_]+):"([a-zA-Z0-9 \@\.]+)"/ | |
# hash[$1.to_sym] = $2 | |
# else | |
# raise "Could not match Facebook #{part}" | |
# end | |
# end | |
# hash | |
#Devise::OmniAuth.unshort_circuit_authorizers! | |
#Devise::OmniAuth.reset_stubs! | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Devise::OmniAuth.test_mode! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Feature: Facebook Connect | |
Scenario: Sign in with Facebook | |
When I go to the sign in page | |
And I press "Sign in with Facebook" | |
And Facebook returns uid:"123", nickname:"chunky.bacon", first_name:"Chunky", last_name:"Bacon", email:"[email protected]" | |
Then I should see "Your mysite account was successfully created" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment