Sha256: 059ed102bc94b139acfcd508ce8271925ccf1528f6647144d2b25468048ae14d

Contents?: true

Size: 1.5 KB

Versions: 2

Compression:

Stored size: 1.5 KB

Contents

== 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.

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
not_a_mock-1.0.1 TODO
not_a_mock-1.0.0 TODO