Changeset 5059
- Timestamp:
- 09/07/06 11:28:49 (2 years ago)
- Files:
-
- plugins/javascript_test/generators (added)
- plugins/javascript_test/generators/javascript_test (added)
- plugins/javascript_test/generators/javascript_test/javascript_test_generator.rb (added)
- plugins/javascript_test/generators/javascript_test/templates (added)
- plugins/javascript_test/generators/javascript_test/templates/javascript_test.html (added)
- plugins/javascript_test/lib/javascript_test.rb (modified) (1 diff)
- plugins/javascript_test/README (modified) (1 diff)
- plugins/javascript_test/tasks/javascript_test.rake (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
plugins/javascript_test/lib/javascript_test.rb
r5058 r5059 156 156 browser.setup 157 157 @tests.each do |test| 158 puts "#{test} on #{browser}"159 158 browser.visit("http://localhost:4711#{test}?resultsURL=http://localhost:4711/results&t=" + ("%.6f" % Time.now.to_f)) 160 159 result = @queue.pop plugins/javascript_test/README
r5058 r5059 2 2 ========================= 3 3 4 Usage: 4 This plugin provides the script.aculo.us JavaScript unit testing framework 5 in way that integrates with Rails applications. 6 7 Usage 8 ===== 9 10 Use the provided generator to built a skeleton for your JavaScript test. 11 The built-in rake task can then be used to automatically run the unit tests 12 in various installed browsers (supported are Firefox on IE/Mac/Linux, 13 Safari on Mac, Konqueror on Linux). 14 15 Note that due to the built-in webrick, you don't have to change anything 16 about your app, just add tests. :) 17 18 Example 19 ======= 20 21 Generate a JavaScript test skeleton for your public/javascripts/foo.js file: 22 23 script/generate javascript_test foo 24 25 Run the unit tests (a "assertTruth" dummy test is provided, so you should see 26 "SUCCESS" messages): 5 27 6 28 rake test:javascripts 7 29 30 You'll find more info on how to write tests on the script.aculo.us wiki: 31 http://wiki.script.aculo.us/scriptaculous/show/UnitTesting 32 33 Questions? 34 ========== 35 36 Join the Rails Spinoffs Google Group, or ask on #prototype on irc.freenode.net. 37 8 38 TODO 39 ==== 9 40 10 * Some more docs :) 11 * Make install task do something 12 * Generator that provides for test skeletons 41 * Some more docs and a presentation :) 13 42 * Make ^C aborting work 43 44 Copyright (c) 2005-2006 Thomas Fuchs, released under the MIT license plugins/javascript_test/tasks/javascript_test.rake
r5058 r5059 4 4 5 5 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') 7 8 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 9 12 10 13 t.browser(:safari) … … 14 17 end 15 18 end 16 17 desc "Setup the necessary files and folders for JavaScript testing"18 task 'test:javascripts:install' => :environment do19 puts "Unfinished"20 end