Sha256: c8f3a37daf14749e1403c1f178922938e5c15ec110dd56ee6f55c6d6d278473f
Contents?: true
Size: 1.09 KB
Versions: 2
Compression:
Stored size: 1.09 KB
Contents
require 'rack' require 'omniauth/test' module OmniAuth module Test # Support for testing OmniAuth strategies. # # @example Usage # class MyStrategyTest < Test::Unit::TestCase # include OmniAuth::Test::StrategyTestCase # def strategy # # return the parameters to a Rack::Builder map call: # [MyStrategy.new, :some, :configuration, :options => 'here'] # end # setup do # post '/auth/my_strategy/callback', :user => { 'name' => 'Dylan', 'id' => '445' } # end # end module StrategyTestCase def app strategy = self.strategy Rack::Builder.new { use OmniAuth::Test::PhonySession use *strategy run lambda { |env| [200, {'Content-Type' => 'text/plain'}, [Rack::Request.new(env).params.key?('auth').to_s]] } }.to_app end def session last_request.env['rack.session'] end def strategy raise NotImplementedError.new('Including specs must define #strategy') end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
oa-core-0.1.6 | lib/omniauth/test/strategy_test_case.rb |
oa-core-0.1.5 | lib/omniauth/test/strategy_test_case.rb |