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

Changeset 5059

Show
Ignore:
Timestamp:
09/07/06 11:28:49 (2 years ago)
Author:
madrobby
Message:

Make javascript_test plugin actually useful

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • plugins/javascript_test/lib/javascript_test.rb

    r5058 r5059  
    156156        browser.setup 
    157157        @tests.each do |test| 
    158           puts "#{test} on #{browser}" 
    159158          browser.visit("http://localhost:4711#{test}?resultsURL=http://localhost:4711/results&t=" + ("%.6f" % Time.now.to_f)) 
    160159          result = @queue.pop 
  • plugins/javascript_test/README

    r5058 r5059  
    22========================= 
    33 
    4 Usage: 
     4This plugin provides the script.aculo.us JavaScript unit testing framework 
     5in way that integrates with Rails applications. 
     6 
     7Usage 
     8===== 
     9 
     10Use the provided generator to built a skeleton for your JavaScript test. 
     11The built-in rake task can then be used to automatically run the unit tests 
     12in various installed browsers (supported are Firefox on IE/Mac/Linux,  
     13Safari on Mac, Konqueror on Linux). 
     14 
     15Note that due to the built-in webrick, you don't have to change anything 
     16about your app, just add tests. :) 
     17 
     18Example 
     19======= 
     20 
     21Generate a JavaScript test skeleton for your public/javascripts/foo.js file: 
     22 
     23script/generate javascript_test foo 
     24 
     25Run the unit tests (a "assertTruth" dummy test is provided, so you should see 
     26"SUCCESS" messages): 
    527 
    628rake test:javascripts 
    729 
     30You'll find more info on how to write tests on the script.aculo.us wiki: 
     31http://wiki.script.aculo.us/scriptaculous/show/UnitTesting 
     32 
     33Questions? 
     34========== 
     35 
     36Join the Rails Spinoffs Google Group, or ask on #prototype on irc.freenode.net. 
     37 
    838TODO 
     39==== 
    940 
    10 * Some more docs :) 
    11 * Make install task do something 
    12 * Generator that provides for test skeletons 
     41* Some more docs and a presentation :) 
    1342* Make ^C aborting work 
     43 
     44Copyright (c) 2005-2006 Thomas Fuchs, released under the MIT license 
  • plugins/javascript_test/tasks/javascript_test.rake

    r5058 r5059  
    44     
    55    t.mount('/assets', RAILS_ROOT+'/vendor/plugins/javascript_test/assets') 
    6     t.mount("/test") 
     6    t.mount("/test", RAILS_ROOT+'/test') 
     7    t.mount("/javascripts", RAILS_ROOT+'/public/javascripts') 
    78     
    8     t.run("application") 
     9    Dir.glob('test/javascript/*_test.html').each do |js| 
     10      t.run(File.basename(js,'.html').gsub(/_test/,'')) 
     11    end 
    912     
    1013    t.browser(:safari) 
     
    1417  end 
    1518end 
    16  
    17 desc "Setup the necessary files and folders for JavaScript testing" 
    18 task 'test:javascripts:install' => :environment do 
    19   puts "Unfinished" 
    20 end