agoragames/errship — Issue #11: Http status is always 200
Author: marioizquierdo
Created: 2011-11-01 20:12:46+00:00
State: open

The rescuers are not using the right http status, for example:

def render_404_error(exception = nil, errship_scope = false)
render :template => '/errship/standard', :locals => {
:status_code => 404, :errship_scope => errship_scope }
end

will return HTTP status 200. I think it should be:

def render_404_error(exception = nil, errship_scope = false)
render :template => '/errship/standard', :locals => {
:status_code => 404, :errship_scope => errship_scope }, :status => 404
end

This is confusing me in some specs of my application; the next example should be ok and it fails like this:

description "When looking for an unexisting record" do
before { get :show, :id => "nonsense" }
it "should return a 404 status" do
it { should respond_with :not_found }
end
end

#=> Failure/Error: should respond with not found
#=> Expected response to be a <:not_found>, but was <200>

The only way to check (in rspec) if the error page was sown is with:

it { should render_template 'errship/standard' }

But this is not very semantic, and it's coupled to the errship implementation.

Was it intentional? Otherwise I can supply a pull request.

Thanks,
Mario Izquierdo.