Sha256: c88b41ad25100146b346356210da6a62f4d1773c56c0686aebf838a23081c398

Contents?: true

Size: 892 Bytes

Versions: 12

Compression:

Stored size: 892 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',
            email: 'shipit@example.com',
            login: 'shipit',
            avatar_url: 'https://example.com',
            api_url: 'https://github.com/api/v3/users/shipit',
          ),
        ),
      )
      @request.env['omniauth.auth'] = auth

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

      user = User.find_by_login('shipit')
      assert_equal 's3cr3t', user.github_access_token
      assert_equal 44, user.github_id
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
shipit-engine-0.10.0 test/controllers/github_authentication_controller_test.rb
shipit-engine-0.9.0 test/controllers/github_authentication_controller_test.rb
shipit-engine-0.8.9 test/controllers/github_authentication_controller_test.rb
shipit-engine-0.8.8 test/controllers/github_authentication_controller_test.rb
shipit-engine-0.8.7 test/controllers/github_authentication_controller_test.rb
shipit-engine-0.8.6 test/controllers/github_authentication_controller_test.rb
shipit-engine-0.8.5 test/controllers/github_authentication_controller_test.rb
shipit-engine-0.8.4 test/controllers/github_authentication_controller_test.rb
shipit-engine-0.8.3 test/controllers/github_authentication_controller_test.rb
shipit-engine-0.8.2 test/controllers/github_authentication_controller_test.rb
shipit-engine-0.8.1 test/controllers/github_authentication_controller_test.rb
shipit-engine-0.8.0 test/controllers/github_authentication_controller_test.rb