Sha256: 20b7bce44e727f39e6707f63be1a786ca2ab6a5c895d25c358017b831343b57c
Contents?: true
Size: 1.03 KB
Versions: 4
Compression:
Stored size: 1.03 KB
Contents
require 'spec_helper' describe Sinatra::Errorcodes do it 'has a version number' do expect(Sinatra::Errorcodes::VERSION).not_to be nil end it 'provides status 500' do expect(HTTPError::InternalServerError::CODE).to be 500 end it 'provides status 400' do expect(HTTPError::BadRequest::CODE).to be 400 end it 'returns status 500 ' do get '/error' expect(last_response.status).to be 500 expect(last_response.body).to eq 'Internal Server Error' end it 'returns status 400' do get '/badrequest' expect(last_response.status).to be 400 expect(last_response.body).to eq 'Bad Request' end it 'returns status 500 with a custom error message' do get '/custom' expect(last_response.status).to be 500 expect(last_response.body).to eq 'Custom error message' end it 'returns status 500 without a message of HTTPError::InternalServerError' do get '/general_error' expect(last_response.status).to be 500 expect(last_response.body).not_to eq 'Internal Server Error' end end
Version data entries
4 entries across 4 versions & 1 rubygems