[rspec-devel] [ rspec-Bugs-11508 ] Exceptions are not raised for Controller Specs
noreply at rubyforge.org
noreply at rubyforge.org
Wed Jun 20 12:54:20 EDT 2007
Bugs item #11508, was opened at 2007-06-11 20:06
You can respond by visiting:
http://rubyforge.org/tracker/?func=detail&atid=3149&aid=11508&group_id=797
Category: rails plugin
Group: None
Status: Open
Resolution: None
Priority: 3
Submitted By: Brian Takita (btakita)
Assigned to: Nobody (None)
Summary: Exceptions are not raised for Controller Specs
Initial Comment:
The issue is old_rescue_action is called if the exception is not a MockExpectationError. This makes it hard to find exceptions in controllers.
The standard Rails test behaviour is to always raise an exception.
It used to work in 0.9.4.
module ActionController
module Rescue
protected
alias old_rescue_action rescue_action
def rescue_action(exception)
raise exception if exception.is_a?(Spec::Mocks::MockExpectationError)
old_rescue_action(exception)
end
end
end
----------------------------------------------------------------------
>Comment By: David Chelimsky (dchelimsky)
Date: 2007-06-20 16:54
Message:
Please do. No objection. In fact, let's plan a 1.0.6 release after you get this done and we fix http://rubyforge.org/tracker/index.php?func=detail&aid=11628&group_id=797&atid=3149.
Whatever the solution is, lets be noisy about it when we do the release. This thing has been happening under the radar and that's probably more frustrating than anything for people.
Thanks Brian.
David
----------------------------------------------------------------------
Comment By: Brian Takita (btakita)
Date: 2007-06-20 16:48
Message:
Unless you guys object, I'm going to fix this issue within
the next few days.
There have been some complaints, and considerable time spent
debugging because of this issue.
----------------------------------------------------------------------
Comment By: Brian Takita (btakita)
Date: 2007-06-19 19:03
Message:
Maybe have the inverse of raise_controller_errors to deviate
from the default (e.g. raise_only_mock_controller_errors)?
----------------------------------------------------------------------
Comment By: Brian Takita (btakita)
Date: 2007-06-19 18:58
Message:
Can we raise errors by default?
This is what most people expect.
----------------------------------------------------------------------
Comment By: David Chelimsky (dchelimsky)
Date: 2007-06-11 20:17
Message:
If you run script/generate rspec you'll see the following in spec_helper.rb:
config.before(:each, :behaviour_type => :controller) do
raise_controller_errors
end
That makes things work as you suspect, and allows you use your own rescue_action if you want to.
This is a bit experimental and hence not very well doc'd, so I'll leave this open. But you can use that for now.
----------------------------------------------------------------------
You can respond by visiting:
http://rubyforge.org/tracker/?func=detail&atid=3149&aid=11508&group_id=797
More information about the rspec-devel
mailing list