test/functional/sites_controller_test.rb in zena-1.2.3 vs test/functional/sites_controller_test.rb in zena-1.2.4

- old
+ new

@@ -20,10 +20,27 @@ assert !File.exist?(filepath) assert !CachedPage.find(:first, :conditions => ["path = ?", "/test.host/public/en/clear_cache_test.html"]) end end + + test 'should clear cache with GET' do + with_caching do + login(:anon) + @node = secure!(Node) { nodes(:status) } + filepath = "#{RAILS_ROOT}/sites/test.host/public/en/clear_cache_test.html" + assert !File.exist?(filepath) + secure!(CachedPage) { CachedPage.create(:expire_after => nil, :path => "/test.host/public/en/clear_cache_test.html", :content_data => "houbahouba", :node_id => @node[:id], :expire_with_ids => visitor.visited_node_ids) } + assert File.exist?(filepath) + assert CachedPage.find(:first, :conditions => ["path = ?", "/test.host/public/en/clear_cache_test.html"]) + login(:lion) + get :clear_cache + assert !File.exist?(filepath) + assert !CachedPage.find(:first, :conditions => ["path = ?", "/test.host/public/en/clear_cache_test.html"]) + end + end + test 'clearing cache should clear zafu' do with_caching do login(:anon) @node = secure!(Node) { nodes(:status) } filepath = "#{RAILS_ROOT}/sites/test.host/zafu/default/Node/fr/_main.erb" @@ -37,9 +54,11 @@ end test "should not have access to sites if not admin" do login(:tiger) get :index + assert_response :missing + get :clear_cache assert_response :missing end test "should get index" do get :index \ No newline at end of file