another 0.0.4 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/README +19 -5
- data/another.gemspec +57 -4
- data/bin/another +6 -1
- data/lib/another/options.rb +1 -1
- data/lib/another/runner.rb +11 -1
- data/spec/another_spec.rb +14 -1
- data/templates/js/README.textile +3 -0
- data/templates/js/manifest.txt +17 -0
- data/templates/js/spec/PROJECT_spec.js +7 -0
- data/templates/js/spec/screw-unit/jquery-1.2.6.js +3549 -0
- data/templates/js/spec/screw-unit/jquery.fn.js +29 -0
- data/templates/js/spec/screw-unit/jquery.print.js +109 -0
- data/templates/js/spec/screw-unit/screw.assets.js +36 -0
- data/templates/js/spec/screw-unit/screw.behaviors.js +91 -0
- data/templates/js/spec/screw-unit/screw.builder.js +94 -0
- data/templates/js/spec/screw-unit/screw.css +90 -0
- data/templates/js/spec/screw-unit/screw.events.js +44 -0
- data/templates/js/spec/screw-unit/screw.matchers.js +163 -0
- data/templates/{ruby/lib/PROJECT/.gitignore → js/spec/spec_helper.js} +0 -0
- data/templates/js/spec/suite.html +21 -0
- data/templates/js/src/PROJECT.js +1 -0
- metadata +20 -34
- data/templates/sinatra/public/.gitignore +0 -0
- data/templates/sinatra/spec/.gitignore +0 -0
- data/templates/sinatra/views/.gitignore +0 -0
@@ -0,0 +1,44 @@
|
|
1
|
+
(function($) {
|
2
|
+
$(Screw)
|
3
|
+
.bind('loaded', function() {
|
4
|
+
$('.describe, .it')
|
5
|
+
.click(function() {
|
6
|
+
document.location = location.href.split('?')[0] + '?' + $(this).fn('selector');
|
7
|
+
return false;
|
8
|
+
})
|
9
|
+
.focus(function() {
|
10
|
+
return $(this).addClass('focused');
|
11
|
+
})
|
12
|
+
.bind('scroll', function() {
|
13
|
+
document.body.scrollTop = $(this).offset().top;
|
14
|
+
});
|
15
|
+
|
16
|
+
$('.it')
|
17
|
+
.bind('enqueued', function() {
|
18
|
+
$(this).addClass('enqueued');
|
19
|
+
})
|
20
|
+
.bind('running', function() {
|
21
|
+
$(this).addClass('running');
|
22
|
+
})
|
23
|
+
.bind('passed', function() {
|
24
|
+
$(this).addClass('passed');
|
25
|
+
})
|
26
|
+
.bind('failed', function(e, reason) {
|
27
|
+
$(this)
|
28
|
+
.addClass('failed')
|
29
|
+
.append($('<p class="error">').text(reason.toString()))
|
30
|
+
|
31
|
+
var file = reason.fileName || reason.sourceURL;
|
32
|
+
var line = reason.lineNumber || reason.line;
|
33
|
+
if (file || line) {
|
34
|
+
$(this).append($('<p class="error">').text('line ' + line + ', ' + file));
|
35
|
+
}
|
36
|
+
})
|
37
|
+
})
|
38
|
+
.bind('before', function() {
|
39
|
+
$('.status').text('Running...');
|
40
|
+
})
|
41
|
+
.bind('after', function() {
|
42
|
+
$('.status').fn('display')
|
43
|
+
})
|
44
|
+
})(jQuery);
|
@@ -0,0 +1,163 @@
|
|
1
|
+
Screw.Matchers = (function($) {
|
2
|
+
return matchers = {
|
3
|
+
expect: function(actual) {
|
4
|
+
var funcname = function(f) {
|
5
|
+
var s = f.toString().match(/function (\w*)/)[1];
|
6
|
+
if ((s == null) || (s.length == 0)) return "anonymous";
|
7
|
+
return s;
|
8
|
+
};
|
9
|
+
|
10
|
+
var stacktrace = function() {
|
11
|
+
var s = "";
|
12
|
+
for(var a = arguments.caller; a != null; a = a.caller) {
|
13
|
+
s += funcname(a.callee) + "\n";
|
14
|
+
if (a.caller == a) break;
|
15
|
+
}
|
16
|
+
return s;
|
17
|
+
};
|
18
|
+
|
19
|
+
return {
|
20
|
+
to: function(matcher, expected, not) {
|
21
|
+
var matched = matcher.match(expected, actual);
|
22
|
+
if (not ? matched : !matched) {
|
23
|
+
console.debug(0);
|
24
|
+
console.debug(stacktrace());
|
25
|
+
console.debug(1);
|
26
|
+
throw(matcher.failure_message(expected, actual, not));
|
27
|
+
}
|
28
|
+
},
|
29
|
+
|
30
|
+
to_not: function(matcher, expected) {
|
31
|
+
this.to(matcher, expected, true);
|
32
|
+
}
|
33
|
+
}
|
34
|
+
},
|
35
|
+
|
36
|
+
equal: {
|
37
|
+
match: function(expected, actual) {
|
38
|
+
if (expected instanceof Array) {
|
39
|
+
for (var i = 0; i < actual.length; i++)
|
40
|
+
if (!Screw.Matchers.equal.match(expected[i], actual[i])) return false;
|
41
|
+
return actual.length == expected.length;
|
42
|
+
} else if (expected instanceof Object) {
|
43
|
+
for (var key in expected)
|
44
|
+
if (expected[key] != actual[key]) return false;
|
45
|
+
for (var key in actual)
|
46
|
+
if (actual[key] != expected[key]) return false;
|
47
|
+
return true;
|
48
|
+
} else {
|
49
|
+
return expected == actual;
|
50
|
+
}
|
51
|
+
},
|
52
|
+
|
53
|
+
failure_message: function(expected, actual, not) {
|
54
|
+
return 'expected ' + $.print(actual) + (not ? ' to not equal ' : ' to equal ') + $.print(expected);
|
55
|
+
}
|
56
|
+
},
|
57
|
+
|
58
|
+
match: {
|
59
|
+
match: function(expected, actual) {
|
60
|
+
if (expected.constructor == RegExp)
|
61
|
+
return expected.exec(actual.toString());
|
62
|
+
else
|
63
|
+
return actual.indexOf(expected) > -1;
|
64
|
+
},
|
65
|
+
|
66
|
+
failure_message: function(expected, actual, not) {
|
67
|
+
return 'expected ' + $.print(actual) + (not ? ' to not match ' : ' to match ') + $.print(expected);
|
68
|
+
}
|
69
|
+
},
|
70
|
+
|
71
|
+
be_empty: {
|
72
|
+
match: function(expected, actual) {
|
73
|
+
if (actual.length == undefined) throw(actual.toString() + " does not respond to length");
|
74
|
+
|
75
|
+
return actual.length == 0;
|
76
|
+
},
|
77
|
+
|
78
|
+
failure_message: function(expected, actual, not) {
|
79
|
+
return 'expected ' + $.print(actual) + (not ? ' to not be empty' : ' to be empty');
|
80
|
+
}
|
81
|
+
},
|
82
|
+
|
83
|
+
have_length: {
|
84
|
+
match: function(expected, actual) {
|
85
|
+
if (actual.length == undefined) throw(actual.toString() + " does not respond to length");
|
86
|
+
|
87
|
+
return actual.length == expected;
|
88
|
+
},
|
89
|
+
|
90
|
+
failure_message: function(expected, actual, not) {
|
91
|
+
return 'expected ' + $.print(actual) + (not ? ' to not' : ' to') + ' have length ' + expected;
|
92
|
+
}
|
93
|
+
},
|
94
|
+
|
95
|
+
be_null: {
|
96
|
+
match: function(expected, actual) {
|
97
|
+
return actual == null;
|
98
|
+
},
|
99
|
+
|
100
|
+
failure_message: function(expected, actual, not) {
|
101
|
+
return 'expected ' + $.print(actual) + (not ? ' to not be null' : ' to be null');
|
102
|
+
}
|
103
|
+
},
|
104
|
+
|
105
|
+
be_undefined: {
|
106
|
+
match: function(expected, actual) {
|
107
|
+
return actual == undefined;
|
108
|
+
},
|
109
|
+
|
110
|
+
failure_message: function(expected, actual, not) {
|
111
|
+
return 'expected ' + $.print(actual) + (not ? ' to not be undefined' : ' to be undefined');
|
112
|
+
}
|
113
|
+
},
|
114
|
+
|
115
|
+
be_true: {
|
116
|
+
match: function(expected, actual) {
|
117
|
+
return actual;
|
118
|
+
},
|
119
|
+
|
120
|
+
failure_message: function(expected, actual, not) {
|
121
|
+
return 'expected ' + $.print(actual) + (not ? ' to not be true' : ' to be true');
|
122
|
+
}
|
123
|
+
},
|
124
|
+
|
125
|
+
be_false: {
|
126
|
+
match: function(expected, actual) {
|
127
|
+
return !actual;
|
128
|
+
},
|
129
|
+
|
130
|
+
failure_message: function(expected, actual, not) {
|
131
|
+
return 'expected ' + $.print(actual) + (not ? ' to not be false' : ' to be false');
|
132
|
+
}
|
133
|
+
},
|
134
|
+
|
135
|
+
match_selector: {
|
136
|
+
match: function(expected, actual) {
|
137
|
+
if (!(actual instanceof jQuery)) {
|
138
|
+
throw expected.toString() + " must be an instance of jQuery to match against a selector"
|
139
|
+
}
|
140
|
+
|
141
|
+
return actual.is(expected);
|
142
|
+
},
|
143
|
+
|
144
|
+
failure_message: function(expected, actual, not) {
|
145
|
+
return 'expected ' + $.print(actual) + (not ? ' to not match selector ' : ' to match selector ') + expected;
|
146
|
+
}
|
147
|
+
},
|
148
|
+
|
149
|
+
contain_selector: {
|
150
|
+
match: function(expected, actual) {
|
151
|
+
if (!(actual instanceof jQuery)) {
|
152
|
+
throw expected.toString() + " must be an instance of jQuery to match against a selector"
|
153
|
+
}
|
154
|
+
|
155
|
+
return actual.find(expected).length > 0;
|
156
|
+
},
|
157
|
+
|
158
|
+
failure_message: function(expected, actual, not) {
|
159
|
+
return 'expected ' + $.print(actual) + (not ? ' to not contain selector ' : ' to contain selector ') + expected;
|
160
|
+
}
|
161
|
+
}
|
162
|
+
}
|
163
|
+
})(jQuery);
|
File without changes
|
@@ -0,0 +1,21 @@
|
|
1
|
+
<html>
|
2
|
+
<head>
|
3
|
+
<script src="./screw-unit/jquery-1.2.6.js"></script>
|
4
|
+
<script src="./screw-unit/jquery.fn.js"></script>
|
5
|
+
<script src="./screw-unit/jquery.print.js"></script>
|
6
|
+
<script src="./screw-unit/screw.builder.js"></script>
|
7
|
+
<script src="./screw-unit/screw.matchers.js"></script>
|
8
|
+
<script src="./screw-unit/screw.events.js"></script>
|
9
|
+
<script src="./screw-unit/screw.behaviors.js"></script>
|
10
|
+
<script src="./spec_helper.js"></script>
|
11
|
+
|
12
|
+
<script src="../src/<%= project_name.underscore %>.js" type="text/javascript"></script>
|
13
|
+
|
14
|
+
<script src="./<%= project_name.underscore %>_spec.js" type="text/javascript"></script>
|
15
|
+
|
16
|
+
<link rel="stylesheet" href="./screw-unit/screw.css" />
|
17
|
+
</head>
|
18
|
+
<body>
|
19
|
+
<div id="dom_test" style="position: absolute; left: -9999"></div>
|
20
|
+
</body>
|
21
|
+
</html>
|
@@ -0,0 +1 @@
|
|
1
|
+
// <%= project_name %>
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: another
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pat Nakajima
|
@@ -31,73 +31,59 @@ extensions: []
|
|
31
31
|
extra_rdoc_files: []
|
32
32
|
|
33
33
|
files:
|
34
|
-
- .git
|
35
34
|
- another.gemspec
|
36
35
|
- bin
|
37
|
-
- bin/.
|
38
|
-
- bin/..
|
39
36
|
- bin/another
|
40
37
|
- lib
|
41
|
-
- lib/.
|
42
|
-
- lib/..
|
43
38
|
- lib/another
|
44
|
-
- lib/another/.
|
45
|
-
- lib/another/..
|
46
39
|
- lib/another/confirmer.rb
|
47
40
|
- lib/another/options.rb
|
48
41
|
- lib/another/runner.rb
|
49
42
|
- lib/another.rb
|
50
43
|
- lib/core_ext
|
51
|
-
- lib/core_ext/.
|
52
|
-
- lib/core_ext/..
|
53
44
|
- lib/core_ext/string.rb
|
54
45
|
- lib/core_ext/symbol.rb
|
55
46
|
- README
|
56
47
|
- spec
|
57
|
-
- spec/.
|
58
|
-
- spec/..
|
59
48
|
- spec/another_spec.rb
|
60
49
|
- spec/spec_helper.rb
|
61
50
|
- templates
|
62
|
-
- templates
|
63
|
-
- templates
|
51
|
+
- templates/js
|
52
|
+
- templates/js/manifest.txt
|
53
|
+
- templates/js/README.textile
|
54
|
+
- templates/js/spec
|
55
|
+
- templates/js/spec/PROJECT_spec.js
|
56
|
+
- templates/js/spec/screw-unit
|
57
|
+
- templates/js/spec/screw-unit/jquery-1.2.6.js
|
58
|
+
- templates/js/spec/screw-unit/jquery.fn.js
|
59
|
+
- templates/js/spec/screw-unit/jquery.print.js
|
60
|
+
- templates/js/spec/screw-unit/screw.assets.js
|
61
|
+
- templates/js/spec/screw-unit/screw.behaviors.js
|
62
|
+
- templates/js/spec/screw-unit/screw.builder.js
|
63
|
+
- templates/js/spec/screw-unit/screw.css
|
64
|
+
- templates/js/spec/screw-unit/screw.events.js
|
65
|
+
- templates/js/spec/screw-unit/screw.matchers.js
|
66
|
+
- templates/js/spec/spec_helper.js
|
67
|
+
- templates/js/spec/suite.html
|
68
|
+
- templates/js/src
|
69
|
+
- templates/js/src/PROJECT.js
|
64
70
|
- templates/ruby
|
65
|
-
- templates/ruby/.
|
66
|
-
- templates/ruby/..
|
67
71
|
- templates/ruby/lib
|
68
|
-
- templates/ruby/lib/.
|
69
|
-
- templates/ruby/lib/..
|
70
72
|
- templates/ruby/lib/PROJECT
|
71
|
-
- templates/ruby/lib/PROJECT/.
|
72
|
-
- templates/ruby/lib/PROJECT/..
|
73
|
-
- templates/ruby/lib/PROJECT/.gitignore
|
74
73
|
- templates/ruby/lib/PROJECT.rb
|
75
74
|
- templates/ruby/manifest.txt
|
76
75
|
- templates/ruby/README.textile
|
77
76
|
- templates/ruby/spec
|
78
|
-
- templates/ruby/spec/.
|
79
|
-
- templates/ruby/spec/..
|
80
77
|
- templates/ruby/spec/PROJECT_spec.rb
|
81
78
|
- templates/ruby/spec/spec_helper.rb
|
82
79
|
- templates/sinatra
|
83
|
-
- templates/sinatra/.
|
84
|
-
- templates/sinatra/..
|
85
80
|
- templates/sinatra/app.rb
|
86
81
|
- templates/sinatra/manifest.txt
|
87
82
|
- templates/sinatra/public
|
88
|
-
- templates/sinatra/public/.
|
89
|
-
- templates/sinatra/public/..
|
90
|
-
- templates/sinatra/public/.gitignore
|
91
83
|
- templates/sinatra/spec
|
92
|
-
- templates/sinatra/spec/.
|
93
|
-
- templates/sinatra/spec/..
|
94
|
-
- templates/sinatra/spec/.gitignore
|
95
84
|
- templates/sinatra/spec/PROJECT_spec.rb
|
96
85
|
- templates/sinatra/spec/spec_helper.rb
|
97
86
|
- templates/sinatra/views
|
98
|
-
- templates/sinatra/views/.
|
99
|
-
- templates/sinatra/views/..
|
100
|
-
- templates/sinatra/views/.gitignore
|
101
87
|
has_rdoc: false
|
102
88
|
homepage:
|
103
89
|
post_install_message:
|
File without changes
|
File without changes
|
File without changes
|