Sha256: a18b893c54ad5370deba8d2208b987f9e543786f151c8cea9713ee7554b52fef

Contents?: true

Size: 687 Bytes

Versions: 4

Compression:

Stored size: 687 Bytes

Contents

require 'warden/github'
require 'warden/github/rails/test_helpers/mock_user'

module Warden
  module GitHub
    module Rails
      module TestHelpers
        include ::Warden::Test::Helpers

        # Login a mock GitHub user and return it.
        def github_login(scope=Rails.default_scope)
          MockUser.new.tap do |user|
            login_as(user, :scope => scope)
          end
        end
      end
    end
  end
end

# Add a method to Rack::Response to easily determine if a request resulted in an
# OAuth redirect to GitHub.
class Rack::Response
  def github_oauth_redirect?
    redirect? and
      location.start_with?('https://github.com/login/oauth/authorize')
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
warden-github-rails-thinknear-fork-1.1.0 lib/warden/github/rails/test_helpers.rb
warden-github-rails-1.0.1 lib/warden/github/rails/test_helpers.rb
warden-github-rails-1.0.0 lib/warden/github/rails/test_helpers.rb
warden-github-rails-0.0.1 lib/warden/github/rails/test_helpers.rb