This repository was archived by the owner on Nov 30, 2024. It is now read-only.
This repository was archived by the owner on Nov 30, 2024. It is now read-only.
Feature Idea: Fail examples when no expectation was set #404
Closed
Description
I'm wondering if it would make sense to fail an example if no expectations were set during it's execution.
Basically I'd want to be notified (one way or the other) if I do something like this
it "shoud calculate a tuples sum" do
tuple = Tuple.new(1,2)
tuple.sum == nil
end
it "should process the payment" do
end
Both examples will "pass". All green. Programmer is happy (at least for a while).
Another useful addition might be to fail examples if a message expectation is the last expression in the example, and thus cannot be met:
it "saves the record" do
post :create
@user.should_receive(:save)
end
after do
# nothing here
end
(I hope I haven't forgotten any corner cases where the expectation could still be met)
One can argue that programmers should be smart enough not to write tests like this. On the other hand, having a passing example should guarantee that something was in fact passed.
Any thoughts?
Simon
Metadata
Metadata
Assignees
Labels
No labels