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

Changeset 8164

Show
Ignore:
Timestamp:
11/17/07 05:41:47 (1 year ago)
Author:
nzkoz
Message:

memoize host with port and refactor the tests which depend on it changing

Files:

Legend:

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

    r8108 r8164  
    167167    # example.com:8080. 
    168168    def host_with_port 
    169       host + port_string 
     169      @host_with_port ||= host + port_string 
    170170    end 
    171171 
  • trunk/actionpack/test/controller/caching_test.rb

    r7666 r8164  
    249249    get :index 
    250250    jamis_cache = content_to_cache 
    251  
     251     
     252    reset! 
     253     
    252254    @request.host = 'david.hostname.com' 
    253255    get :index 
     
    255257    assert_not_equal jamis_cache, @response.body 
    256258 
     259    reset! 
     260 
    257261    @request.host = 'jamis.hostname.com' 
    258262    get :index 
    259263    assert_equal jamis_cache, @response.body 
     264 
     265    reset! 
    260266 
    261267    @request.host = 'david.hostname.com' 
  • trunk/actionpack/test/controller/request_test.rb

    r8108 r8164  
    253253 
    254254 
    255   def test_host_with_port 
     255  def test_host_with_default_port 
    256256    @request.host = "rubyonrails.org" 
    257257    @request.port = 80 
    258258    assert_equal "rubyonrails.org", @request.host_with_port 
    259  
     259  end 
     260   
     261  def test_host_with_non_default_port 
    260262    @request.host = "rubyonrails.org" 
    261263    @request.port = 81