Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

73 lines (57 sloc) 2.8 kb
_ ____
| / ___| _ __ ___ ___
_ | \___ \| '_ \ / _ \/ __|
| |_| |___) | |_) | __/ (__
\___/|____/| .__/ \___|\___|
|_|
# 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
Jump to Line
Something went wrong with that request. Please try again.