-
Notifications
You must be signed in to change notification settings - Fork 4
/
TODO
49 lines (31 loc) · 1.5 KB
/
TODO
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
== 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)
end
=== 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.