visionmedia-jspec 2.6.0 → 2.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/History.rdoc +5 -0
- data/Manifest +3 -0
- data/README.rdoc +18 -0
- data/bin/jspec +1 -1
- data/jspec.gemspec +3 -3
- data/lib/jspec.js +17 -1
- data/spec/fixtures/test.html +1 -0
- data/spec/fixtures/test.json +1 -0
- data/spec/fixtures/test.xml +5 -0
- data/spec/spec.utils.js +15 -0
- data/templates/default/spec/spec.rhino.js +1 -0
- data/templates/default/spec/spec.server.html +1 -0
- data/templates/rails/spec.rhino.js +1 -0
- data/templates/rails/spec.server.html +1 -0
- metadata +5 -2
data/History.rdoc
CHANGED
data/Manifest
CHANGED
data/README.rdoc
CHANGED
@@ -14,6 +14,7 @@ and much more.
|
|
14
14
|
* Rhino support
|
15
15
|
* Node.js support
|
16
16
|
* Async support
|
17
|
+
* Fixture support
|
17
18
|
* Ruby JavaScript testing server
|
18
19
|
* Nested describes
|
19
20
|
* Does not pollute core object prototypes
|
@@ -378,6 +379,23 @@ OR
|
|
378
379
|
.exec('...')
|
379
380
|
.run({ formatter : JSpec.formatters.Terminal })
|
380
381
|
.report()
|
382
|
+
|
383
|
+
== Fixtures
|
384
|
+
|
385
|
+
The fixture() utility function may be used in order to load arbitrary file contents
|
386
|
+
for use with your specifications. JSpec will resolve fixture('data') in the following
|
387
|
+
manor:
|
388
|
+
|
389
|
+
- 'data'
|
390
|
+
- 'spec/data'
|
391
|
+
- 'spec/fixtures/data'
|
392
|
+
- 'spec/fixtures/data.html'
|
393
|
+
|
394
|
+
So if the file 'spec/fixtures/data.html' exists, we can simply use fixture('data'),
|
395
|
+
where as 'spec/fixtures/xml/data.xml' must be specified with fixture('xml/data.xml').
|
396
|
+
|
397
|
+
If you prefer not to store fixtures in the 'fixtures' directory you must be more specific
|
398
|
+
with the path supplied.
|
381
399
|
|
382
400
|
== Custom Matchers
|
383
401
|
|
data/bin/jspec
CHANGED
data/jspec.gemspec
CHANGED
@@ -2,17 +2,17 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{jspec}
|
5
|
-
s.version = "2.
|
5
|
+
s.version = "2.7.0"
|
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-07-
|
9
|
+
s.date = %q{2009-07-14}
|
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
|
-
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/env.js", "spec/jquery-1.3.1.js", "spec/modules.js", "spec/spec.dom.html", "spec/spec.grammar-less.js", "spec/spec.grammar.js", "spec/spec.jquery.js", "spec/spec.js", "spec/spec.matchers.js", "spec/spec.modules.js", "spec/spec.node.js", "spec/spec.rhino.js", "spec/spec.server.html", "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.dom.html", "templates/default/spec/spec.rhino.js", "templates/default/spec/spec.server.html", "templates/rails/spec.application.js", "templates/rails/spec.dom.html", "templates/rails/spec.rhino.js", "templates/rails/spec.server.html"]
|
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/env.js", "spec/fixtures/test.html", "spec/fixtures/test.json", "spec/fixtures/test.xml", "spec/jquery-1.3.1.js", "spec/modules.js", "spec/spec.dom.html", "spec/spec.grammar-less.js", "spec/spec.grammar.js", "spec/spec.jquery.js", "spec/spec.js", "spec/spec.matchers.js", "spec/spec.modules.js", "spec/spec.node.js", "spec/spec.rhino.js", "spec/spec.server.html", "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.dom.html", "templates/default/spec/spec.rhino.js", "templates/default/spec/spec.server.html", "templates/rails/spec.application.js", "templates/rails/spec.dom.html", "templates/rails/spec.rhino.js", "templates/rails/spec.server.html"]
|
16
16
|
s.homepage = %q{http://visionmedia.github.com/jspec}
|
17
17
|
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Jspec", "--main", "README.rdoc"]
|
18
18
|
s.require_paths = ["lib"]
|
data/lib/jspec.js
CHANGED
@@ -5,7 +5,8 @@
|
|
5
5
|
|
6
6
|
JSpec = {
|
7
7
|
|
8
|
-
version : '2.
|
8
|
+
version : '2.7.0',
|
9
|
+
cache : {},
|
9
10
|
suites : [],
|
10
11
|
modules : [],
|
11
12
|
allSuites : [],
|
@@ -46,6 +47,21 @@
|
|
46
47
|
|
47
48
|
an_instance_of : function(constructor) {
|
48
49
|
return { an_instance_of : constructor }
|
50
|
+
},
|
51
|
+
|
52
|
+
fixture : function(path) {
|
53
|
+
if (JSpec.cache[path]) return JSpec.cache[path]
|
54
|
+
function tryLoading(path) {
|
55
|
+
try { return JSpec.load(path) }
|
56
|
+
catch (e) {}
|
57
|
+
}
|
58
|
+
return JSpec.cache[path] =
|
59
|
+
tryLoading(path) ||
|
60
|
+
tryLoading('fixtures/' + path) ||
|
61
|
+
tryLoading('fixtures/' + path + '.html') ||
|
62
|
+
tryLoading('spec/' + path) ||
|
63
|
+
tryLoading('spec/fixtures/' + path) ||
|
64
|
+
tryLoading('spec/fixtures/' + path + '.html')
|
49
65
|
}
|
50
66
|
},
|
51
67
|
|
@@ -0,0 +1 @@
|
|
1
|
+
<p>test</p>
|
@@ -0,0 +1 @@
|
|
1
|
+
{ users : { tj : { email : 'tj@vision-media.ca' }}}
|
data/spec/spec.utils.js
CHANGED
@@ -255,4 +255,19 @@ describe 'Utility'
|
|
255
255
|
JSpec.contentsOf(-{ return 'foo' }).should.include 'return', 'foo'
|
256
256
|
end
|
257
257
|
end
|
258
|
+
|
259
|
+
describe 'fixture()'
|
260
|
+
it 'should return a files contents'
|
261
|
+
fixture('fixtures/test.html').should.eql '<p>test</p>'
|
262
|
+
fixture('test.html').should.eql '<p>test</p>'
|
263
|
+
fixture('test').should.eql '<p>test</p>'
|
264
|
+
end
|
265
|
+
|
266
|
+
it 'should cache contents'
|
267
|
+
contents = fixture('test')
|
268
|
+
JSpec.cache['test'].should.eql contents
|
269
|
+
JSpec.cache['test'] = 'foo'
|
270
|
+
fixture('test').should.eql 'foo'
|
271
|
+
end
|
272
|
+
end
|
258
273
|
end
|
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.
|
4
|
+
version: 2.7.0
|
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-07-
|
12
|
+
date: 2009-07-14 00:00:00 -07:00
|
13
13
|
default_executable: jspec
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -70,6 +70,9 @@ files:
|
|
70
70
|
- server/server.rb
|
71
71
|
- spec/async
|
72
72
|
- spec/env.js
|
73
|
+
- spec/fixtures/test.html
|
74
|
+
- spec/fixtures/test.json
|
75
|
+
- spec/fixtures/test.xml
|
73
76
|
- spec/jquery-1.3.1.js
|
74
77
|
- spec/modules.js
|
75
78
|
- spec/spec.dom.html
|