Sha256: 5d7348cdfc913d95efcaa3792cf5a7273ba6fc768f11daa59e0a80f24dde6783

Contents?: true

Size: 1.31 KB

Versions: 9

Compression:

Stored size: 1.31 KB

Contents

$LOAD_PATH.unshift File.expand_path(__dir__)
$LOAD_PATH.unshift File.expand_path('../lib', __dir__)

require 'simplecov'
SimpleCov.start

if ENV['CI'] == 'true'
  require 'codecov'
  SimpleCov.formatter = SimpleCov::Formatter::Codecov
end

require 'rspec'
require 'rack/test'
require 'webmock/rspec'
require 'omniauth'
require 'omniauth-auth0'
require 'sinatra'

WebMock.disable_net_connect!

RSpec.configure do |config|
  config.include WebMock::API
  config.include Rack::Test::Methods
  config.extend OmniAuth::Test::StrategyMacros, type: :strategy

  def app
    @app || make_application
  end

  def make_application(options = {})
    client_id = 'CLIENT_ID'
    secret = 'CLIENT_SECRET'
    domain = 'samples.auth0.com'
    client_id = options.delete(:client_id) if options.key?(:client_id)
    secret = options.delete(:client_secret) if options.key?(:client_secret)
    domain = options.delete(:domain) if options.key?(:domain)

    Sinatra.new do
      configure do
        enable :sessions
        set :show_exceptions, false
        set :session_secret, 'TEST'
      end

      use OmniAuth::Builder do
        provider :auth0, client_id, secret, domain, options
      end

      get '/auth/auth0/callback' do
        MultiJson.encode(env['omniauth.auth'])
      end
    end
  end
end

OmniAuth.config.logger = Logger.new('/dev/null')

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
omniauth-auth0-3.0.0 spec/spec_helper.rb
omniauth-auth0-2.6.0 spec/spec_helper.rb
omniauth-auth0-2.5.0 spec/spec_helper.rb
omniauth-auth0-2.4.2 spec/spec_helper.rb
omniauth-auth0-2.4.1 spec/spec_helper.rb
omniauth-auth0-2.4.0 spec/spec_helper.rb
omniauth-auth0-2.3.1 spec/spec_helper.rb
omniauth-auth0-2.3.0 spec/spec_helper.rb
omniauth-auth0-2.2.0 spec/spec_helper.rb