spec/spec.matchers.js in visionmedia-jspec-2.1.0 vs spec/spec.matchers.js in visionmedia-jspec-2.2.0
- old
+ new
@@ -180,12 +180,12 @@
end
end
describe 'throw_error'
it 'should check if an error is thrown'
- -{ throw 'error' }.should_throw_error
- -{ return 'test' }.should_not_throw_error
+ -{ throw 'error' }.should.throw_error
+ -{ return 'test' }.should.not.throw_error
end
it 'should check if an error with a specific message is thrown'
-{ throw 'some foo bar' }.should.throw_error('some foo bar')
-{ throw 'some foo bar' }.should.throw_error(/foo bar/)
@@ -195,9 +195,18 @@
it 'should check if an error of a specific constructor is thrown'
-{ throw new Error('foo') }.should.throw_error(Error)
-{ throw new TypeError('foo') }.should.throw_error(TypeError)
-{ throw 'foo' }.should.not.throw_error(Error)
+ end
+
+ it 'should check if an error with a specific constructor and message is thrown'
+ -{ throw new TypeError('oh no!') }.should.throw_error(TypeError, 'oh no!')
+ -{ throw new TypeError('oh no!') }.should.not.throw_error(TypeError, 'foo bar')
+ -{ throw new TypeError('oh no!') }.should.throw_error(TypeError, /oh no/)
+ -{ throw new TypeError('oh no!') }.should.not.throw_error(TypeError, /foo bar/)
+ -{ throw new TypeError('oh no!') }.should.not.throw_error(Error, 'oh no!')
+ -{ throw new TypeError('oh no!') }.should.not.throw_error(Error, 'foo bar')
end
end
describe 'be_an_instance_of'
it 'should check that an object is an instance of another'
\ No newline at end of file