A few of our tests attempt to test controllers with production-style
rescuing. Before the current rspec/Rails 2.2.2 combo, it was fairly easy to
set up for these tests:
it "should throw a 404 for strange actions" do
controller.use_rails_error_handling!
get :strange_action_name
response.should be_missing
response.body.should include("You've hit our custom 404 page.")
end
As of trunk rspec/Rails 2.2.2, this doesn't work. It turns out that
ActionController::TestCase has invented its own hook for testing. Without
this hook set, you end up
in 'local development' mode. So to get into production mode, you need to do
this:
it "should throw a 404 for strange actions" do
controller.use_rails_error_handling! # rspec no longer throws the error
without hitting Rails logic
rescue_action_in_public! # ActionController::TestCase no longer considers
this request a local request
get :strange_action_name
response.should be_missing
response.body.should include("You've hit our custom 404 page.")
end
Of course, if you have 'rescue_from' handlers, these will happen no matter
what.
I guess my question is, now that the 'rescue_action_in_public!' hook exists
in Rails, does it still make sense for rspec-rails to have its own method?
Might it make sense
to merge the two functionalities in some way?
=Nathan
_______________________________________________
rspec-users mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/rspec-users