Skip to content

Instantly share code, notes, and snippets.

@renugasaraswathy
Created June 7, 2019 20:14
Show Gist options
  • Save renugasaraswathy/9fbaabcd19330dc19de9a7b295a66af4 to your computer and use it in GitHub Desktop.
Save renugasaraswathy/9fbaabcd19330dc19de9a7b295a66af4 to your computer and use it in GitHub Desktop.
Testing Facebook login with Rspec & Capybara using koala gem- Ruby on Rails
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