-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathjavascript.jspec.sheet
73 lines (57 loc) · 2.73 KB
/
javascript.jspec.sheet
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
_ ____
| / ___| _ __ ___ ___
_ | \___ \| '_ \ / _ \/ __|
| |_| |___) | |_) | __/ (__
\___/|____/| .__/ \___|\___|
|_|
# Grammar
describe "Something"
describe "#method()"
it "should do something"
var something = new Something
something.method().should.be_true
end
end
end
# Grammar-less
JSpec.describe("Something", function(){
describe("#method()", function(){
it("should do something", function(){
var something = new Something
expect(something.method()).to(be_true)
})
})
})
# Executable
$ jspec # Same as 'jspec run --bind'
$ jspec --rhino # Same as 'jspec run --bind --rhino'
$ jspec run --bind --rhino # Run suites using Rhino when modified
$ jspec run # Run suites once in Safari
$ jspec run --bind # Run suites in Safari when modified
$ jspec run --browsers safari,opera,ff # Run suites in Safari,Firefox, and Opera
$ jspec run --server # Run Ruby server in all supported browsers
$ jspec run --server --browsers opera,ff # Run Ruby server in Opera and Firefox
$ jspec init # Creates template in the current directory
$ jspec init path/to/myproject # Creates template at 'path/to/myproject'
$ jspec update # Updates the JSpec project in the current directory
$ jspec help # View help information
$ jspec help run # View help for a specific sub-command (run in this case)
# Grammar Conversions
1..5 [1,2,3,4,5] # Ex: number.should.be_within(1..5)
-{ foo } function(){ foo } # Ex: -{ foo() }.should.throw_error(/something/)
obj.stub('method') stub(obj, 'method') # Ex: foo.stub('bar').and_return('baz')
foo.should.eql 'bar' expect(foo).to(eql, 'bar')
# Fixture Resolution
Set the "fixturePath" option.
- <fixturePath>/PATH
- <fixturePath>/PATH.html
# Mock XMLHttpRequest
mock_request().and_return('{ foo: "bar" }', 'application/json', 200, { Accept: 'foo' })
# More Information
docs : http://jspec.info
irc : irc://irc.freenode.net#jspec
readme : http://github.com/visionmedia/jspec
google group : http://groups.google.com/group/jspec
rails support : http://visionmedia.github.com/jspec/rails.html
drupal support : https://github.com/visionmedia/jspec-drupal
textmate bundle : http://github.com/visionmedia/jspec.tmbundle/tree/master