Sha256: 208febeb830dad24081eaf4429968ef2d68800875adc09a492839a2205d9537f

Contents?: true

Size: 1.2 KB

Versions: 5

Compression:

Stored size: 1.2 KB

Contents

=begin
  lib/locale_rails/action_controller.rb - Ruby/Locale for "Ruby on Rails"

  Copyright (C) 2009  Masao Mutoh

  You may redistribute it and/or modify it under the same
  license terms as Ruby.

=end

require 'action_controller'
require 'action_controller/test_process'

module ActionController
  if defined? AbstractRequest  #:nodoc:
    # for Rails-2.2.x or earlier. 
    class TestRequest < AbstractRequest  #:nodoc:
      class LocaleMockCGI < CGI #:nodoc:
        attr_accessor :stdinput, :stdoutput, :env_table
        
        def initialize(env, input=nil)
          self.env_table = env
          self.stdinput = StringIO.new(input || "")
          self.stdoutput = StringIO.new
          
          super()
        end
      end

      @cgi = nil
      def cgi
        unless @cgi
          @cgi = LocaleMockCGI.new("REQUEST_METHOD" => "GET",
                                   "QUERY_STRING"   => "",
                                   "REQUEST_URI"    => "/",
                                   "HTTP_HOST"      => "www.example.com",
                                   "SERVER_PORT"    => "80",
                                   "HTTPS"          => "off")
        end
        @cgi
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
locale_rails-2.0.1 lib/locale_rails/action_controller/test_process.rb
locale_rails-2.0.2 lib/locale_rails/action_controller/test_process.rb
locale_rails-2.0.3 lib/locale_rails/action_controller/test_process.rb
locale_rails-2.0.4 lib/locale_rails/action_controller/test_process.rb
locale_rails-2.0.0 lib/locale_rails/action_controller/test_process.rb