Sha256: 2f271978c087bdc854eb9c5c91c9676e21e2f728bc5eca98f63d9df16667e3b9

Contents?: true

Size: 948 Bytes

Versions: 10

Compression:

Stored size: 948 Bytes

Contents

# frozen_string_literal: true
require 'test_helper'

module Shipit
  class GithubAuthenticationControllerTest < ActionController::TestCase
    test ":callback can sign in to github" do
      auth = OmniAuth::AuthHash.new(
        credentials: OmniAuth::AuthHash.new(
          token: 's3cr3t',
        ),
        extra: OmniAuth::AuthHash.new(
          raw_info: OmniAuth::AuthHash.new(
            id: 44,
            name: 'Shipit User',
            email: 'shipit-user@example.com',
            login: 'shipit-user',
            avatar_url: 'https://example.com',
            api_url: 'https://github.com/api/v3/users/shipit-user',
          ),
        ),
      )
      @request.env['omniauth.auth'] = auth

      assert_difference -> { User.count } do
        get :callback
      end

      user = User.find_by(login: 'shipit-user')
      assert_equal 's3cr3t', user.github_access_token
      assert_equal 44, user.github_id
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
shipit-engine-0.39.0 test/controllers/github_authentication_controller_test.rb
shipit-engine-0.38.0 test/controllers/github_authentication_controller_test.rb
shipit-engine-0.37.0 test/controllers/github_authentication_controller_test.rb
shipit-engine-0.36.1 test/controllers/github_authentication_controller_test.rb
shipit-engine-0.36.0 test/controllers/github_authentication_controller_test.rb
shipit-engine-0.35.1 test/controllers/github_authentication_controller_test.rb
shipit-engine-0.35.0 test/controllers/github_authentication_controller_test.rb
shipit-engine-0.34.0 test/controllers/github_authentication_controller_test.rb
shipit-engine-0.33.0 test/controllers/github_authentication_controller_test.rb
shipit-engine-0.32.0 test/controllers/github_authentication_controller_test.rb