-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#217307 Simple spec for authenticate with facebook.
- Loading branch information
Showing
6 changed files
with
74 additions
and
13 deletions.
There are no files selected for viewing
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
require 'spec_helper' | ||
|
||
feature 'Sign up via Facebook' do | ||
|
||
background do | ||
visit root_path | ||
click_link 'Sign in' | ||
|
||
OmniAuth.config.mock_auth[:facebook] = { | ||
:provider => 'facebook', | ||
:uid => '123545', | ||
:credentials => { | ||
:token => 'facebook token' | ||
} | ||
} | ||
end | ||
|
||
scenario 'click login via facebook' do | ||
click_link 'Login via Facebook' | ||
page.should have_content('Sign up') | ||
|
||
within 'form#new_user' do | ||
fill_in 'Email', :with => 'facebook@user.com' | ||
fill_in 'Password', :with => 'password' | ||
fill_in 'Password confirmation', :with => 'password' | ||
click_button 'Sign up' | ||
end | ||
|
||
page.should have_content('Welcome! You have signed up successfully.') | ||
page.should have_content('facebook@user.com') | ||
current_path.should == root_path | ||
|
||
user = User.find_by_email('facebook@user.com') | ||
user.should_not be_nil | ||
user.accounts.should have(1).item | ||
|
||
facebook_account = user.accounts.last | ||
facebook_account.provider.should == 'facebook' | ||
facebook_account.uid.should == '123545' | ||
facebook_account.token.should == 'facebook token' | ||
|
||
click_link 'Sign out' | ||
|
||
visit root_path | ||
click_link 'Sign in' | ||
click_link 'Login via Facebook' | ||
|
||
page.should have_content('Signed in successfully.') | ||
page.should have_content('facebook@user.com') | ||
end | ||
|
||
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