README.rdoc in visionmedia-jspec-2.2.1 vs README.rdoc in visionmedia-jspec-2.3.0
- old
+ new
@@ -24,10 +24,11 @@
* Default / customizable evaluation contexts
* DOM sandbox support
* Great looking default DOM theme
* `jspec` command-line utility for auto-running specs, and initializing project templates
* Proxy or 'Spy' assertions
+* Method Stubbing
* Shared behaviors
* Profiling
* Rails Integration (http://github.com/bhauman/jspec-rails)
* Tiny (15 kb compressed, 1300-ish LOC)
@@ -200,10 +201,26 @@
array.should.receive('toString').and_return('foo,bar')
'array: ' + array // This line causes the spec to pass due to calling toString()
For more examples view spec/spec.matchers.js
+== Method Stubbing
+
+JSpec currently provides very simple stubbing support shown below:
+
+ person = { toString : function(){ return '<Person>' } }
+ stub(person, 'toString').and_return('Ive been stubbed!')
+
+To destub a method simply call destub() at any time:
+
+ destub(person, 'toString')
+
+If you would like to whipe an object clear of stubs simply pass it
+to destub() without an additional method argument:
+
+ destub(person)
+
== Helpers
* Core
- an_instance_of used in conjunction with the 'receive' matcher
@@ -450,9 +467,12 @@
== Known Issues
* Tabs may cause a parse error. To prevent this use 'soft tabs' (setting in your IDE/Editor)
or use JSpec's grammar-less alternative (mentioned above).
+
+* The negation of the should_receive matcher is currently not available. (ex:
+ foo.should.not.receive('toString()') will not work)
== More Information
* Featured article in JSMag: http://www.jsmag.com/main.issues.description/id=21/
* Syntax comparison with other frameworks http://gist.github.com/92283