Sha256: 7309cdb59bdcc5e930b11c454f28fb3a36c12b51c06e6e550d696349326db593
Contents?: true
Size: 907 Bytes
Versions: 1
Compression:
Stored size: 907 Bytes
Contents
require 'spec_helper' describe Grape::Middleware::Error do class ErrApp class << self attr_accessor :error attr_accessor :format def call(env) throw :error, error end end end def app Rack::Builder.app do use Grape::Middleware::Error, default_message: 'Aww, hamburgers.' run ErrApp end end it 'sets the status code appropriately' do ErrApp.error = { status: 410 } get '/' last_response.status.should == 410 end it 'sets the error message appropriately' do ErrApp.error = { message: 'Awesome stuff.' } get '/' last_response.body.should == 'Awesome stuff.' end it 'defaults to a 500 status' do ErrApp.error = {} get '/' last_response.status.should == 500 end it 'has a default message' do ErrApp.error = {} get '/' last_response.body.should == 'Aww, hamburgers.' end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
grape-0.7.0 | spec/grape/middleware/error_spec.rb |