Incorrect expectation count when entire test suite run vs. single spec file

15 views
Skip to first unread message

Eric Milford

unread,
Apr 25, 2012, 11:17:58 AM4/25/12
to rspec
I have a couple of specs that pass when run in isolation, but fail
when run w/ the entire test suite. The tests expect single
expectations that pass correctly when run alone, but I get an error
that the expectation was expected 1 time but received 2 times when run
w/ the entire test suite. The action around the expectation is
triggered in an after_create callback and there are other specs that
create models and therefore trigger this action. It seems that state
isn't being cleared correctly? Is there something I need to do to
resolve this or any suggestions? Thanks.

David Chelimsky

unread,
Apr 25, 2012, 11:52:57 AM4/25/12
to rs...@googlegroups.com
Gotta provide a bit more context. I can guess what might be going
wrong, but we could end up going back and forth for quite a while.
Please post one of the examples that fails intermittently, including
any lets, befores, etc. And probably the after_create callback as
well.

Thanks,
David

Eric Milford

unread,
Apr 25, 2012, 6:17:16 PM4/25/12
to rspec
I'm also seeing the wrong expectation counts (and a few more, I think)
when I use let instead of let!.

Eric Milford

unread,
Apr 25, 2012, 5:59:54 PM4/25/12
to rspec


Here is an example of the failing specs...

https://gist.github.com/4cc802291686a6f5bc46

The callback is in the model

after_destroy { Notifier.notify_time_cancelled(self) }

Thanks!




On Apr 25, 11:52 am, David Chelimsky <dchelim...@gmail.com> wrote:

David Chelimsky

unread,
Apr 26, 2012, 7:00:45 AM4/26/12
to rs...@googlegroups.com
Thanks for posting that. I put some questions/comments in the gist.

Reply all
Reply to author
Forward
0 new messages