visionmedia-jspec 2.0.1 → 2.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/History.rdoc +7 -0
- data/README.rdoc +3 -1
- data/bin/jspec +1 -1
- data/jspec.gemspec +3 -4
- data/lib/jspec.js +13 -16
- data/spec/spec.js +11 -1
- data/spec/spec.matchers.js +4 -0
- metadata +3 -3
data/History.rdoc
CHANGED
@@ -1,4 +1,11 @@
|
|
1
1
|
|
2
|
+
=== 2.0.2 / 2009-05-11
|
3
|
+
|
4
|
+
* Added rails integration link http://github.com/bhauman/jspec-rails
|
5
|
+
* Changed; puts() now displays constructor name when available
|
6
|
+
* Fixed Terminal output which was not displaying due to a recent commit
|
7
|
+
* fixed IE bug : DOM elements don't have valueOf() method
|
8
|
+
|
2
9
|
=== 2.0.1 / 2009-05-01
|
3
10
|
|
4
11
|
* Added better failure messages for throw_error matcher
|
data/README.rdoc
CHANGED
@@ -28,6 +28,7 @@ and much more.
|
|
28
28
|
* Proxy or 'Spy' assertions
|
29
29
|
* Shared behaviors
|
30
30
|
* Profiling
|
31
|
+
* Rails Integration (http://github.com/bhauman/jspec-rails)
|
31
32
|
* Tiny (15 kb compressed, 1600-ish LOC)
|
32
33
|
|
33
34
|
== Installation
|
@@ -43,7 +44,8 @@ At which point you may:
|
|
43
44
|
$ jspec init myproject
|
44
45
|
|
45
46
|
JSpec scripts should NOT be referenced via the <script> tag, they should be
|
46
|
-
loaded using the exec method
|
47
|
+
loaded using the exec method (unless you are using the grammar-less alternative).
|
48
|
+
Below is an example:
|
47
49
|
|
48
50
|
...
|
49
51
|
<script>
|
data/bin/jspec
CHANGED
data/jspec.gemspec
CHANGED
@@ -2,23 +2,22 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{jspec}
|
5
|
-
s.version = "2.0.
|
5
|
+
s.version = "2.0.2"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["TJ Holowaychuk"]
|
9
|
-
s.date = %q{2009-05-
|
9
|
+
s.date = %q{2009-05-11}
|
10
10
|
s.default_executable = %q{jspec}
|
11
11
|
s.description = %q{JavaScript BDD Testing Framework}
|
12
12
|
s.email = %q{tj@vision-media.ca}
|
13
13
|
s.executables = ["jspec"]
|
14
14
|
s.extra_rdoc_files = ["bin/jspec", "lib/images/bg.png", "lib/images/hr.png", "lib/images/loading.gif", "lib/images/sprites.bg.png", "lib/images/sprites.png", "lib/images/vr.png", "lib/jspec.css", "lib/jspec.jquery.js", "lib/jspec.js", "README.rdoc"]
|
15
15
|
s.files = ["bin/jspec", "History.rdoc", "jspec.gemspec", "lib/images/bg.png", "lib/images/hr.png", "lib/images/loading.gif", "lib/images/sprites.bg.png", "lib/images/sprites.png", "lib/images/vr.png", "lib/jspec.css", "lib/jspec.jquery.js", "lib/jspec.js", "Manifest", "Rakefile", "README.rdoc", "server/browsers.rb", "server/server.rb", "spec/async", "spec/jquery-1.3.1.js", "spec/server.html", "spec/spec.grammar-less.js", "spec/spec.grammar.js", "spec/spec.html", "spec/spec.jquery.js", "spec/spec.js", "spec/spec.matchers.js", "spec/spec.rhino.js", "spec/spec.shared-behaviors.js", "spec/spec.utils.js", "templates/default/History.rdoc", "templates/default/lib/yourlib.core.js", "templates/default/README.rdoc", "templates/default/spec/spec.core.js", "templates/default/spec/spec.html", "templates/rhino/History.rdoc", "templates/rhino/lib/yourlib.core.js", "templates/rhino/README.rdoc", "templates/rhino/spec/spec.core.js", "templates/rhino/spec/spec.js", "templates/server/History.rdoc", "templates/server/lib/yourlib.core.js", "templates/server/README.rdoc", "templates/server/spec/spec.core.js", "templates/server/spec/spec.html"]
|
16
|
-
s.has_rdoc = true
|
17
16
|
s.homepage = %q{http://visionmedia.github.com/jspec}
|
18
17
|
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Jspec", "--main", "README.rdoc"]
|
19
18
|
s.require_paths = ["lib"]
|
20
19
|
s.rubyforge_project = %q{jspec}
|
21
|
-
s.rubygems_version = %q{1.3.
|
20
|
+
s.rubygems_version = %q{1.3.3}
|
22
21
|
s.summary = %q{JavaScript BDD Testing Framework}
|
23
22
|
|
24
23
|
if s.respond_to? :specification_version then
|
data/lib/jspec.js
CHANGED
@@ -3,9 +3,9 @@
|
|
3
3
|
|
4
4
|
(function(){
|
5
5
|
|
6
|
-
|
6
|
+
JSpec = {
|
7
7
|
|
8
|
-
version : '2.0.
|
8
|
+
version : '2.0.2',
|
9
9
|
suites : [],
|
10
10
|
allSuites : [],
|
11
11
|
matchers : {},
|
@@ -138,7 +138,7 @@
|
|
138
138
|
|
139
139
|
Terminal : function(results, options) {
|
140
140
|
failuresOnly = option('failuresOnly')
|
141
|
-
|
141
|
+
print(color("\n Passes: ", 'bold') + color(results.stats.passes, 'green') +
|
142
142
|
color(" Failures: ", 'bold') + color(results.stats.failures, 'red') + "\n")
|
143
143
|
|
144
144
|
indent = function(string) {
|
@@ -148,20 +148,20 @@
|
|
148
148
|
renderSuite = function(suite) {
|
149
149
|
displaySuite = failuresOnly ? suite.ran && !suite.passed() : suite.ran
|
150
150
|
if (displaySuite && suite.hasSpecs()) {
|
151
|
-
|
151
|
+
print(color(' ' + suite.description, 'bold'))
|
152
152
|
each(suite.specs, function(spec){
|
153
153
|
var assertionsGraph = inject(spec.assertions, '', function(graph, assertion){
|
154
154
|
return graph + color('.', assertion.passed ? 'green' : 'red')
|
155
155
|
})
|
156
156
|
if (spec.requiresImplementation())
|
157
|
-
|
157
|
+
print(color(' ' + spec.description, 'blue') + assertionsGraph)
|
158
158
|
else if (spec.passed() && !failuresOnly)
|
159
|
-
|
159
|
+
print(color(' ' + spec.description, 'green') + assertionsGraph)
|
160
160
|
else if (!spec.passed())
|
161
|
-
|
162
|
-
"\n" + indent(spec.failure().message) + "\n")
|
161
|
+
print(color(' ' + spec.description, 'red') + assertionsGraph +
|
162
|
+
"\n" + indent(spec.failure().message) + "\n")
|
163
163
|
})
|
164
|
-
|
164
|
+
print("")
|
165
165
|
}
|
166
166
|
}
|
167
167
|
|
@@ -231,8 +231,8 @@
|
|
231
231
|
// Run the assertion
|
232
232
|
|
233
233
|
run : function() {
|
234
|
-
// TODO: remove unshifting
|
235
|
-
expected.unshift(actual
|
234
|
+
// TODO: remove unshifting
|
235
|
+
expected.unshift(actual)
|
236
236
|
this.result = matcher.match.apply(this, expected)
|
237
237
|
this.passed = negate ? !this.result : this.result
|
238
238
|
if (!this.passed) this.message = matcher.message.call(this, actual, expected, negate, matcher.name)
|
@@ -748,6 +748,7 @@
|
|
748
748
|
switch (object.constructor) {
|
749
749
|
case String: return "'" + escape(object) + "'"
|
750
750
|
case Number: return object
|
751
|
+
case Function: return object.name || object
|
751
752
|
case Array :
|
752
753
|
return inject(object, '[', function(b, v){
|
753
754
|
return b + ', ' + puts(v)
|
@@ -1336,7 +1337,7 @@
|
|
1336
1337
|
var error = JSpec.error
|
1337
1338
|
var escape = JSpec.escape
|
1338
1339
|
var extend = JSpec.extend
|
1339
|
-
var puts
|
1340
|
+
var puts = JSpec.puts
|
1340
1341
|
var hash = JSpec.hash
|
1341
1342
|
var query = JSpec.query
|
1342
1343
|
var strip = JSpec.strip
|
@@ -1464,8 +1465,4 @@
|
|
1464
1465
|
}
|
1465
1466
|
})
|
1466
1467
|
|
1467
|
-
// --- Expose
|
1468
|
-
|
1469
|
-
this.JSpec = JSpec
|
1470
|
-
|
1471
1468
|
})()
|
data/spec/spec.js
CHANGED
@@ -37,7 +37,7 @@ describe 'Negative specs'
|
|
37
37
|
false.should.be_true
|
38
38
|
end
|
39
39
|
|
40
|
-
it 'should fail
|
40
|
+
it 'should fail saying an error was throw'
|
41
41
|
-{ throw 'foo' }.should.not.throw_error
|
42
42
|
end
|
43
43
|
|
@@ -64,6 +64,16 @@ describe 'Negative specs'
|
|
64
64
|
-{ throw new Bar }.should.throw_error Foo
|
65
65
|
end
|
66
66
|
|
67
|
+
it 'should fail with function body string'
|
68
|
+
-{ 'foo' }.should.not.include 'foo'
|
69
|
+
end
|
70
|
+
|
71
|
+
it 'should fail with constructor name'
|
72
|
+
function Foo(){ this.toString = function(){ return '<Foo>' }}
|
73
|
+
foo = new Foo
|
74
|
+
foo.should.not.be_an_instance_of Foo
|
75
|
+
end
|
76
|
+
|
67
77
|
it 'should fail with message of first failure'
|
68
78
|
true.should.be_true
|
69
79
|
'bar'.should.match(/foo/gm)
|
data/spec/spec.matchers.js
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: visionmedia-jspec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- TJ Holowaychuk
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-05-
|
12
|
+
date: 2009-05-11 00:00:00 -07:00
|
13
13
|
default_executable: jspec
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -85,7 +85,7 @@ files:
|
|
85
85
|
- templates/server/README.rdoc
|
86
86
|
- templates/server/spec/spec.core.js
|
87
87
|
- templates/server/spec/spec.html
|
88
|
-
has_rdoc:
|
88
|
+
has_rdoc: false
|
89
89
|
homepage: http://visionmedia.github.com/jspec
|
90
90
|
post_install_message:
|
91
91
|
rdoc_options:
|