-
-
Save harssh/469b650a7039cdfa731ffb9fe7de88a3 to your computer and use it in GitHub Desktop.
This file contains 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 => 'user@example.com', | |
: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 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 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:"bacon@mysite.co.nz" | |
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