Sha256: a44c097328cd483a38e3d1785b13ce8a103090cf9914b8325239607fa3ab0ddf

Contents?: true

Size: 918 Bytes

Versions: 15

Compression:

Stored size: 918 Bytes

Contents

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

15 entries across 15 versions & 1 rubygems

Version Path
shipit-engine-0.31.0 test/controllers/github_authentication_controller_test.rb
shipit-engine-0.30.0 test/controllers/github_authentication_controller_test.rb
shipit-engine-0.29.0 test/controllers/github_authentication_controller_test.rb
shipit-engine-0.28.1 test/controllers/github_authentication_controller_test.rb
shipit-engine-0.28.0 test/controllers/github_authentication_controller_test.rb
shipit-engine-0.27.1 test/controllers/github_authentication_controller_test.rb
shipit-engine-0.27.0 test/controllers/github_authentication_controller_test.rb
shipit-engine-0.26.0 test/controllers/github_authentication_controller_test.rb
shipit-engine-0.25.1 test/controllers/github_authentication_controller_test.rb
shipit-engine-0.25.0 test/controllers/github_authentication_controller_test.rb
shipit-engine-0.24.0 test/controllers/github_authentication_controller_test.rb
shipit-engine-0.23.1 test/controllers/github_authentication_controller_test.rb
shipit-engine-0.23.0 test/controllers/github_authentication_controller_test.rb
shipit-engine-0.22.0 test/controllers/github_authentication_controller_test.rb
shipit-engine-0.21.0 test/controllers/github_authentication_controller_test.rb