Created
February 15, 2009 19:53
-
-
Save dchelimsky/64833 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require File.dirname(__FILE__) + '/../../../spec_helper' | |
require 'controller_spec_controller' | |
['integration', 'isolation'].each do |mode| | |
describe "A controller example running in #{mode} mode", :type => :controller do | |
controller_name :controller_spec | |
integrate_views if mode == 'integration' | |
describe "with an error that is not rescued in the controller" do | |
context "without rails' error handling" do | |
it "raises the error" do | |
lambda do | |
get 'un_rescued_error_action' | |
end.should raise_error(ControllerSpecController::UnRescuedError) | |
end | |
end | |
context "with rails' error handling" do | |
it "returns the error code" do | |
controller.use_rails_error_handling! | |
get 'un_rescued_error_action' | |
response.response_code.should == 500 | |
end | |
end | |
end | |
describe "with an error that is rescued in the controller" do | |
context "without rails' error handling" do | |
it "returns the error code" do | |
get 'rescued_error_action' | |
response.response_code.should == 200 | |
end | |
end | |
context "with rails' error handling" do | |
it "returns the error code" do | |
controller.use_rails_error_handling! | |
get 'rescued_error_action' | |
response.response_code.should == 200 | |
end | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment