Created
June 7, 2019 20:14
-
-
Save renugasaraswathy/9fbaabcd19330dc19de9a7b295a66af4 to your computer and use it in GitHub Desktop.
Testing Facebook login with Rspec & Capybara using koala gem- Ruby on Rails
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
require 'rails_helper' | |
require 'koala' | |
feature 'Login using facebook' do | |
before do | |
@test_users_api=Koala::Facebook::TestUsers.new(:app_id =>FB_APP_ID , :secret =>FB_SECRET_KEY) | |
@test_user=@test_users_api.create(false) | |
end | |
after do | |
@test_users_api.delete(@test_user["id"]) | |
end | |
scenario 'authenticates successfully' do | |
visit root_path | |
click_on "Sign In" | |
click_on "Login with Facebook" | |
fill_in "email",with: @test_user["email"] | |
fill_in "pass",with: @test_user["password"] | |
click_on "loginbutton" | |
find(:xpath, "//button[@name='__CONFIRM__']").click | |
expect(page).to have_content("Successfully authenticated from Facebook account.") | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment