mirror of
https://github.com/projekteuler/projekteuler.git
synced 2026-11-23 19:33:46 +01:00
Add authentication via GitHub
This commit is contained in:
1 parent
8ba5608689
commit
f70a5275f0
8 files changed
+50
-3
No files matched your search
@@ -0,0 +1,19 @@
|
||||
require 'test_helper'
|
||||
|
||||
class TranslatorFlowTest < ActionDispatch::IntegrationTest
|
||||
test "can view a problem" do
|
||||
get '/problems/1'
|
||||
assert_response :success
|
||||
assert_select "h1", "First title Problem 1"
|
||||
end
|
||||
|
||||
test "can login via github" do
|
||||
get '/users/auth/github'
|
||||
assert_response :redirect
|
||||
follow_redirect!
|
||||
follow_redirect!
|
||||
assert_response :success
|
||||
assert controller.user_signed_in?
|
||||
assert_equal "translator", controller.current_user.name
|
||||
end
|
||||
end
|
||||
@@ -20,3 +20,13 @@ class ActiveSupport::TestCase
|
||||
sign_in translator
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
class ActionDispatch::IntegrationTest
|
||||
OmniAuth.config.test_mode = true
|
||||
OmniAuth.config.mock_auth[:github] = OmniAuth::AuthHash.new({
|
||||
provider: :github,
|
||||
uid: 'translator',
|
||||
name: 'translator'
|
||||
})
|
||||
end
|
||||
Reference in new issue
Block a user