Sha256: a2eb1fc1ed4d3342f06c0dbf38a0493eaffd2979509379f3e224c79266953f80

Contents?: true

Size: 917 Bytes

Versions: 13

Compression:

Stored size: 917 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

13 entries across 13 versions & 1 rubygems

Version Path
shipit-engine-0.20.1 test/controllers/github_authentication_controller_test.rb
shipit-engine-0.20.0 test/controllers/github_authentication_controller_test.rb
shipit-engine-0.19.0 test/controllers/github_authentication_controller_test.rb
shipit-engine-0.18.1 test/controllers/github_authentication_controller_test.rb
shipit-engine-0.18.0 test/controllers/github_authentication_controller_test.rb
shipit-engine-0.17.0 test/controllers/github_authentication_controller_test.rb
shipit-engine-0.16.0 test/controllers/github_authentication_controller_test.rb
shipit-engine-0.15.0 test/controllers/github_authentication_controller_test.rb
shipit-engine-0.14.0 test/controllers/github_authentication_controller_test.rb
shipit-engine-0.13.0 test/controllers/github_authentication_controller_test.rb
shipit-engine-0.12.1 test/controllers/github_authentication_controller_test.rb
shipit-engine-0.12.0 test/controllers/github_authentication_controller_test.rb
shipit-engine-0.11.0 test/controllers/github_authentication_controller_test.rb