newjs 1.2.1 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +2 -1
- data/Manifest.txt +9 -0
- data/javascript_test_generators/functional_test/functional_test_generator.rb +1 -2
- data/javascript_test_generators/unit_test/unit_test_generator.rb +1 -1
- data/lib/newjs/version.rb +2 -2
- data/rails_generators/javascript_test/USAGE +5 -0
- data/rails_generators/javascript_test/javascript_test_generator.rb +65 -0
- data/rails_generators/javascript_test/templates/assets/jsunittest.js +964 -0
- data/rails_generators/javascript_test/templates/assets/unittest.css +50 -0
- data/rails_generators/javascript_test/templates/plugins/javascript_unittest/README +10 -0
- data/rails_generators/javascript_test/templates/plugins/javascript_unittest/lib/jstest.rb +382 -0
- data/rails_generators/javascript_test/templates/plugins/javascript_unittest/tasks/runner.rake +24 -0
- data/rails_generators/javascript_test/templates/test.html.erb +57 -0
- data/test/test_functional_test_generator.rb +1 -1
- data/test/test_javascript_test_generator.rb +60 -0
- data/website/index.html +1 -1
- metadata +12 -2
@@ -0,0 +1,57 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
|
+
<head>
|
5
|
+
<title>JavaScript unit test file</title>
|
6
|
+
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
7
|
+
<script src="assets/jsunittest.js" type="text/javascript"></script>
|
8
|
+
|
9
|
+
<script src="../../public/javascripts/<%= library_name %>.js" type="text/javascript"></script>
|
10
|
+
|
11
|
+
<link rel="stylesheet" href="assets/unittest.css" type="text/css" />
|
12
|
+
</head>
|
13
|
+
<body>
|
14
|
+
|
15
|
+
<div id="content">
|
16
|
+
|
17
|
+
<div id="header">
|
18
|
+
<h1>JavaScript unit test file</h1>
|
19
|
+
<p>
|
20
|
+
This file tests <strong><%= library_name %>.js</strong>.
|
21
|
+
</p>
|
22
|
+
</div>
|
23
|
+
|
24
|
+
<!-- Log output (one per Runner, via {testLog: "testlog"} option)-->
|
25
|
+
<div id="testlog"></div>
|
26
|
+
|
27
|
+
<!-- Put sample/test html here -->
|
28
|
+
<div id="sample"></div>
|
29
|
+
</div>
|
30
|
+
|
31
|
+
<script type="text/javascript">
|
32
|
+
// <![CDATA[
|
33
|
+
|
34
|
+
new Test.Unit.Runner({
|
35
|
+
// replace this with your real tests
|
36
|
+
setup: function() {
|
37
|
+
|
38
|
+
},
|
39
|
+
|
40
|
+
teardown: function() {
|
41
|
+
|
42
|
+
},
|
43
|
+
|
44
|
+
testTruth: function() { with(this) {
|
45
|
+
assert(true);
|
46
|
+
}}
|
47
|
+
|
48
|
+
}, {testLog: "testlog"});
|
49
|
+
// For each Test.UnitRunner instance, specify the element id where results will be
|
50
|
+
// published; e.g. <div id="testlog"/> above.
|
51
|
+
// That is, you can have multiple "new Test.Unit.Runner() { ... }" on this page, just
|
52
|
+
// create more <div id="testlog2"></div> etc, and pass the element id to the hash above:
|
53
|
+
// e.g. {testLog: "testlog2"}
|
54
|
+
// ]]>
|
55
|
+
</script>
|
56
|
+
</body>
|
57
|
+
</html>
|
@@ -0,0 +1,60 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), "test_generator_helper.rb")
|
2
|
+
|
3
|
+
module Rails
|
4
|
+
module Generator
|
5
|
+
class Base < RubiGen::Base
|
6
|
+
end
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
class TestJavascriptTestGenerator < Test::Unit::TestCase
|
11
|
+
include RubiGen::GeneratorTestHelper
|
12
|
+
|
13
|
+
def setup
|
14
|
+
bare_setup
|
15
|
+
end
|
16
|
+
|
17
|
+
def teardown
|
18
|
+
bare_teardown
|
19
|
+
end
|
20
|
+
|
21
|
+
# Some generator-related assertions:
|
22
|
+
# assert_generated_file(name, &block) # block passed the file contents
|
23
|
+
# assert_directory_exists(name)
|
24
|
+
# assert_generated_class(name, &block)
|
25
|
+
# assert_generated_module(name, &block)
|
26
|
+
# assert_generated_test_for(name, &block)
|
27
|
+
# The assert_generated_(class|module|test_for) &block is passed the body of the class/module within the file
|
28
|
+
# assert_has_method(body, *methods) # check that the body has a list of methods (methods with parentheses not supported yet)
|
29
|
+
#
|
30
|
+
# Other helper methods are:
|
31
|
+
# app_root_files - put this in teardown to show files generated by the test method (e.g. p app_root_files)
|
32
|
+
# bare_setup - place this in setup method to create the APP_ROOT folder for each test
|
33
|
+
# bare_teardown - place this in teardown method to destroy the TMP_ROOT or APP_ROOT folder after each test
|
34
|
+
|
35
|
+
def test_generator_without_options
|
36
|
+
name = "mylib"
|
37
|
+
run_generator('javascript_test', [name], sources)
|
38
|
+
assert_directory_exists "test/javascript/assets"
|
39
|
+
assert_directory_exists "vendor/plugins/javascript_unittest"
|
40
|
+
assert_generated_file "test/javascript/assets/jsunittest.js"
|
41
|
+
assert_generated_file "test/javascript/assets/unittest.css"
|
42
|
+
assert_generated_file "test/javascript/#{name}_test.html" do |body|
|
43
|
+
expected = %Q{src="assets/jsunittest.js"}
|
44
|
+
assert_match(expected, body)
|
45
|
+
end
|
46
|
+
assert_generated_file "vendor/plugins/javascript_unittest/lib/jstest.rb"
|
47
|
+
assert_generated_file "vendor/plugins/javascript_unittest/tasks/runner.rake"
|
48
|
+
assert_generated_file "vendor/plugins/javascript_unittest/README"
|
49
|
+
end
|
50
|
+
|
51
|
+
private
|
52
|
+
def sources
|
53
|
+
[RubiGen::PathSource.new(:test, File.join(File.dirname(__FILE__),"..", generator_path))
|
54
|
+
]
|
55
|
+
end
|
56
|
+
|
57
|
+
def generator_path
|
58
|
+
"rails_generators"
|
59
|
+
end
|
60
|
+
end
|
data/website/index.html
CHANGED
@@ -31,7 +31,7 @@
|
|
31
31
|
<h1>JavaScript Project Generator</h1>
|
32
32
|
<div id="version" class="clickable" onclick='document.location = "http://rubyforge.org/projects/newjs"; return false'>
|
33
33
|
<p>Get Version</p>
|
34
|
-
<a href="http://rubyforge.org/projects/newjs" class="numbers">1.
|
34
|
+
<a href="http://rubyforge.org/projects/newjs" class="numbers">1.3.0</a>
|
35
35
|
</div>
|
36
36
|
<h1>→ ‘newjs’</h1>
|
37
37
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: newjs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dr Nic Williams
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-02-
|
12
|
+
date: 2008-02-19 00:00:00 +10:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -119,6 +119,14 @@ files:
|
|
119
119
|
- newjs_theme_generators/plain_theme/templates/website/javascripts/rounded_corners_lite.inc.js
|
120
120
|
- newjs_theme_generators/plain_theme/templates/website/stylesheets/screen.css
|
121
121
|
- newjs_theme_generators/plain_theme/templates/website/template.html.erb
|
122
|
+
- rails_generators/javascript_test/USAGE
|
123
|
+
- rails_generators/javascript_test/javascript_test_generator.rb
|
124
|
+
- rails_generators/javascript_test/templates/assets/jsunittest.js
|
125
|
+
- rails_generators/javascript_test/templates/assets/unittest.css
|
126
|
+
- rails_generators/javascript_test/templates/plugins/javascript_unittest/README
|
127
|
+
- rails_generators/javascript_test/templates/plugins/javascript_unittest/lib/jstest.rb
|
128
|
+
- rails_generators/javascript_test/templates/plugins/javascript_unittest/tasks/runner.rake
|
129
|
+
- rails_generators/javascript_test/templates/test.html.erb
|
122
130
|
- script/destroy
|
123
131
|
- script/generate
|
124
132
|
- script/txt2html
|
@@ -130,6 +138,7 @@ files:
|
|
130
138
|
- test/test_generator_helper.rb
|
131
139
|
- test/test_helper.rb
|
132
140
|
- test/test_install_website_generator.rb
|
141
|
+
- test/test_javascript_test_generator.rb
|
133
142
|
- test/test_newjs_generator.rb
|
134
143
|
- test/test_plain_theme_generator.rb
|
135
144
|
- test/test_unit_test_generator.rb
|
@@ -171,6 +180,7 @@ test_files:
|
|
171
180
|
- test/test_generator_helper.rb
|
172
181
|
- test/test_helper.rb
|
173
182
|
- test/test_install_website_generator.rb
|
183
|
+
- test/test_javascript_test_generator.rb
|
174
184
|
- test/test_newjs_generator.rb
|
175
185
|
- test/test_plain_theme_generator.rb
|
176
186
|
- test/test_unit_test_generator.rb
|