omniauth--omniauth/spec/spec_helper.rb

35 lines
786 B
Ruby
Raw Normal View History

2011-10-30 20:04:18 +00:00
unless ENV['TRAVIS']
require 'simplecov'
SimpleCov.start
end
require 'rspec'
require 'rack/test'
require 'omniauth'
2011-09-03 18:08:07 +00:00
require 'omniauth/test'
2012-04-12 20:50:13 +00:00
OmniAuth.config.logger = Logger.new("/dev/null")
2011-04-22 18:13:24 +00:00
RSpec.configure do |config|
config.include Rack::Test::Methods
2011-09-03 18:08:07 +00:00
config.extend OmniAuth::Test::StrategyMacros, :type => :strategy
2011-04-22 18:13:24 +00:00
end
2011-09-03 18:08:07 +00:00
class ExampleStrategy
include OmniAuth::Strategy
option :name, 'test'
def call(env); self.call!(env) end
attr_reader :last_env
def request_phase
@fail = fail!(options[:failure]) if options[:failure]
@last_env = env
return @fail if @fail
raise "Request Phase"
end
def callback_phase
@fail = fail!(options[:failure]) if options[:failure]
@last_env = env
return @fail if @fail
raise "Callback Phase"
end
end