Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

javascript_test plugin: seperate success/failure tests

  • Loading branch information...
commit 2634e25949c21eda8f541b5bda3fabfc191d445f 1 parent 83ace50
@madrobby madrobby authored
View
14 test/javascript_test_test.rb
@@ -6,16 +6,18 @@
class JavascriptTestTest < Test::Unit::TestCase
- def test_javascript_test_runner
- runner = JavaScriptTest::Runner.new do |t|
+ def runner_for(test)
+ JavaScriptTest::Runner.new do |t|
t.mount("/test", RAILS_ROOT+'/test')
t.mount('/test/javascript/assets', RAILS_ROOT+'/../assets')
- t.run('test')
-
+ t.run(test)
t.browser(:firefox)
end
-
- assert runner.successful?
+ end
+
+ def test_javascript_test_runner
+ assert runner_for(:success).successful?
+ assert !(runner_for(:failure).successful?)
end
end
View
50 test/test/javascript/failure_test.html
@@ -0,0 +1,50 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <title>JavaScript unit test file</title>
+ <meta http-equiv="content-type" content="text/html; charset=utf-8" />
+ <script src="assets/prototype.js" type="text/javascript"></script>
+ <script src="assets/unittest.js" type="text/javascript"></script>
+ <link rel="stylesheet" href="assets/unittest.css" type="text/css" />
+</head>
+<body>
+
+<div id="content">
+
+ <div id="header">
+ <h1>JavaScript unit test file</h1>
+ <p>
+ This file tests <strong>test.js</strong>.
+ </p>
+ </div>
+
+ <!-- Log output -->
+ <div id="testlog"> </div>
+
+</div>
+
+<script type="text/javascript">
+// <![CDATA[
+
+ new Test.Unit.Runner({
+
+ // replace this with your real tests
+
+ setup: function() {
+
+ },
+
+ teardown: function() {
+
+ },
+
+ testFailure: function() { with(this) {
+ assert(false);
+ }}
+
+ }, "testlog");
+// ]]>
+</script>
+</body>
+</html>
View
2  test/test/javascript/test_test.html → test/test/javascript/success_test.html
@@ -39,7 +39,7 @@
},
- testFluxiomObject: function() { with(this) {
+ testSuccess: function() { with(this) {
assert(true);
}}
Please sign in to comment.
Something went wrong with that request. Please try again.