Changeset 149

Show
Ignore:
Timestamp:
10/10/06 20:54:06 (2 years ago)
Author:
ahorn
Message:

corex branch: introduce stricter caching unit tests

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/corex/radiant/test/functional/admin/page_controller_test.rb

    r148 r149  
    183183  end 
    184184  def test_clear_cache__post 
    185     post :clear_cache 
     185    assert_expire('/', '/documentation', '/documentation/books', '/parent/child') do |*urls| 
     186      post :clear_cache 
     187    end 
    186188    assert_redirected_to page_index_url 
    187189    assert_match /cache.*clear/i, flash[:notice] 
  • branches/corex/radiant/test/functional/site_controller_test.rb

    r148 r149  
    1313    @request    = ActionController::TestRequest.new 
    1414    @response   = ActionController::TestResponse.new 
    15     @controller.clear_cache_directory 
    1615  end 
    1716 
     
    121120   
    122121  def test_show_page__cached 
    123     @controller.clear_cache_directory 
    124     get :show_page, :url => 'documentation' 
    125     assert_response :success 
    126     assert File.exists?(cache_file('documentation')) 
    127     @controller.clear_cache_directory 
    128     assert !File.exists?(cache_file('documentation')) 
     122    assert_cache('/', '/documentation', '/documentation/books', '/parent/child') do |*urls| 
     123      urls.each { |url| get :show_page, :url => url } 
     124    end 
    129125  end 
    130126   
    131127  def test_show_page__no_cache 
    132     @controller.clear_cache_directory 
    133     get :show_page, :url => 'no-cache' 
    134     assert_response :success 
    135     assert !File.exists?(cache_file('no-cache')) 
     128    assert_raises(Test::Unit::AssertionFailedError) do 
     129      assert_cache('/no-cache') do |url| 
     130        get :show_page, :url => 'no-cache' 
     131      end 
     132    end 
    136133  end 
    137134   
     
    162159  private 
    163160   
    164     def cache_file(path, extension = "html") 
    165  
    166       "#{@controller.class.page_cache_directory}/#{path}.#{extension}" 
    167     end 
    168      
    169161    def response(options = {}) 
    170162      r = ActionController::TestResponse.new