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

Changeset 5138

Show
Ignore:
Timestamp:
09/18/06 10:24:42 (2 years ago)
Author:
madrobby
Message:

JavaScript test plugin: Issue headers that prevent caching, #6218, added test for JavaScript test runner

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • plugins/javascript_test/CHANGELOG

    r5072 r5138  
    11*SVN* 
     2 
     3* Added test for JavaScript test runner 
     4 
     5* Issue headers that prevent caching, #6218 [voidlock] 
    26 
    37* Allow for manual execution of tests by manually providing an assets symlink (see README) 
  • plugins/javascript_test/lib/javascript_test.rb

    r5059 r5138  
    1 require 'rake/tasklib' 
     1#require 'rake/tasklib' 
    22require 'thread' 
    33require 'webrick' 
     
    126126end 
    127127 
     128class NonCachingFileHandler < WEBrick::HTTPServlet::FileHandler 
     129  def do_GET(req, res) 
     130    super 
     131    res['etag'] = nil 
     132    res['last-modified'] = Time.now + 1000 
     133    res['Cache-Control'] = 'no-store, no-cache, must-revalidate, post-check=0, pre-check=0"' 
     134    res['Pragma'] = 'no-cache' 
     135    res['Expires'] = Time.now - 1000 
     136  end 
     137end 
     138 
    128139class JavaScriptTestrunner 
    129140 
     
    132143    @tests = [] 
    133144    @browsers = [] 
     145    @result = true 
    134146 
    135147    @queue = Queue.new 
     
    145157     
    146158    define 
     159  end 
     160   
     161  def successful? 
     162    @result 
    147163  end 
    148164 
     
    159175          result = @queue.pop 
    160176          puts "#{test} on #{browser}: #{result}" 
     177          @result = false unless result == 'SUCCESS' 
    161178        end 
    162179        browser.teardown 
     
    174191    dir ||= (Dir.pwd + path) 
    175192 
    176     @server.mount(path, WEBrick::HTTPServlet::FileHandler, dir) 
     193    @server.mount(path, NonCachingFileHandler, dir) 
    177194  end 
    178195