sign_in_with_github_spec.rb
672 Bytes
require 'acceptance/acceptance_helper'
feature 'Sign in with GitHub' do
background do
Errbit::Config.stub(:github_authentication) { true }
Fabricate(:user, :github_login => 'nashby')
end
scenario 'log in via GitHub with recognized user' do
mock_auth('nashby')
visit '/'
click_link 'Sign in with GitHub'
page.should have_content I18n.t("devise.omniauth_callbacks.success", :kind => 'GitHub')
end
scenario 'reject unrecognized user if authenticating via GitHub' do
mock_auth('unknown_user')
visit '/'
click_link 'Sign in with GitHub'
page.should have_content 'There are no authorized users with GitHub login'
end
end