Sha256: 5537e3acacff127635c3516e2d9874f0cbbf54f6bafa7ea0b27f94d5087556c8

Contents?: true

Size: 809 Bytes

Versions: 2

Compression:

Stored size: 809 Bytes

Contents

module Authlogic
  module TestCase
    # Adapts authlogic to work with the @request object when testing. This way Authlogic can set cookies and what not before
    # a request is made, ultimately letting you log in users in functional tests.
    class ControllerAdapter < ControllerAdapters::AbstractAdapter
      def authenticate_with_http_basic(&block)
        controller.authenticate_with_http_basic(&block)
      end
      
      def cookies
        new_cookies = {}
        super.each do |key, value|
          new_cookies[key] = value[:value]
        end
        new_cookies
      end
      
      def cookie_domain
        nil
      end
      
      def request
        @request ||= MockRequest.new
      end
      
      def request_content_type
        request.format.to_s
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
authlogic-2.0.5 lib/authlogic/test_case/controller_adapter.rb
authlogic-2.0.4 lib/authlogic/test_case/controller_adapter.rb