Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
50 lines (31 sloc) 1.5 KB
== To Do
=== Recording calls that throw exceptions
Currently calls to methods that throw exceptions are not recorded. It would
be good if they were, and if assertions could be made against them, e.g.
object.should have_received(:gsub).and_raised(ArgumentError)
=== Stubbing and recording of methods that take blocks
You can't stub or record calls for methods that take blocks. This is very
difficult to fix in Ruby 1.8, but will be much easier in 1.9.
=== Better Error Messages
Error messages are pretty smart already. If I call:
object.should have_received(:gsub).with("Hello", "Goodbye").and_returned("Goodbye, world!")
I might get an error like:
Object received gsub, but not with arguments ["Hello", "Goodbye"].
It would be much more useful if the error message told you the arguments
it actually received as well.
=== Order Assertions
I should be able to write something like this to assert that the calls
happened in order:
in_order do
object_a.should have_received(:message_a)
object_b.should have_received(:message_b)
object_a.should have_received(:message_c)
=== Smarter ActiveRecord stubbing
I often find myself doing something like this before a test:
@comment = Comment.stub_object(:body => "Great!")
@comments = Object.stub_object(:find => [@comment])
@article = Article.stub_object(:title => "Hello, world!", :comments => @comments)
Article.stub_method(:find => @article)
I'd like to find a way to make this neater, auto-generate the stub
relationship, etc.