Skip to content
Browse files

Enable iFrame based result transport.

  • Loading branch information...
1 parent d0d28f5 commit a286887049c5a9abd84b26bfe167b69bf33ba329 @tobie committed Dec 13, 2008
View
12 assets/unittest_transport.js
@@ -1 +1,11 @@
-function postUnittestResults(results) { alert(results.toString()) };
+function postUnittestResults(results) {
+ var fields = ['tests', 'assertions', 'failures', 'errors'],
+ prefix = 'unittest_js_',
+ prop;
+
+ for (var i = 0; i < fields.length; i++) {
+ prop = fields[i]
+ document.getElementById(prefix + prop).value = results[prop];
+ }
+ document.getElementById(prefix + 'transport_form').submit();
+};
View
2 lib/unittest_js/webrick_runner/runner_options.rb
@@ -32,7 +32,7 @@ def test_file_suffix
def test_file_pattern
"*#{test_file_suffix}"
end
-
+
private
def normalize_dir(dir, default)
dir = File.join(test_dir, default) unless dir
View
9 lib/unittest_js/webrick_runner/test_results.rb
@@ -5,15 +5,16 @@ class TestResults
FAILURE = 'F'
ERROR = 'E'
SUCCESS = '.'
+ PREFIX = 'unittest_js_'
attr_reader :tests, :assertions, :failures, :errors
def initialize(req)
@req = req
- @tests = req.query['tests'].to_i
- @assertions = req.query['assertions'].to_i
- @failures = req.query['failures'].to_i
- @errors = req.query['errors'].to_i
+ @tests = (req.query['tests'] || req.query["#{PREFIX}tests"]).to_i
+ @assertions = (req.query['assertions'] || req.query["#{PREFIX}assertions"]).to_i
+ @failures = (req.query['failures'] || req.query["#{PREFIX}failures"]).to_i
+ @errors = (req.query['errors'] || req.query["#{PREFIX}errors"]).to_i
end
def filename

0 comments on commit a286887

Please sign in to comment.
Something went wrong with that request. Please try again.