Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Changeset 3908

Show
Ignore:
Timestamp:
03/18/06 03:27:37 (3 years ago)
Author:
david
Message:

Added access to remote_addr in integration tests (closes #4266) [Chad Fowler]

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/actionpack/lib/action_controller/integration_test.rb

    r3840 r3908  
    2727 
    2828      # The hostname used in the last request. 
    29       attr_reader :host 
     29      attr_accessor :host 
     30 
     31      # The remote_addr used in the last request. 
     32      attr_accessor :remote_addr 
    3033 
    3134      # A map of the cookies returned by the last response, and which will be 
     
    6265        @controller = @request = @response = nil 
    6366       
    64         host! "www.example.test" 
     67        self.host        = "www.example.test" 
     68        self.remote_addr = "127.0.0.1" 
    6569 
    6670        unless @named_routes_configured 
     
    99103        @host = name 
    100104      end 
    101  
    102       # To make setting the host more natural when using a session object 
    103       # directly: foo.host = "blah" 
    104       alias_method :host=, :host! 
    105105 
    106106      # Follow a single redirect response. If the last response was not a 
     
    205205            "REQUEST_URI"    => path, 
    206206            "HTTP_HOST"      => host, 
     207            "REMOTE_ADDR"    => remote_addr, 
    207208            "SERVER_PORT"    => (https? ? "443" : "80"), 
    208209            "CONTENT_TYPE"   => "application/x-www-form-urlencoded", 
     
    430431    # changes to those variables. So, we make those two attributes copy-on-write. 
    431432 
    432     class<<self 
     433    class << self 
    433434      def use_transactional_fixtures=(flag) #:nodoc: 
    434435        @_use_transactional_fixtures = true