Sha256: 2eaecf947910fcb0da6f79301a5abbc7e5a600509afff863c7fcdfdd26eb9a25
Contents?: true
Size: 1008 Bytes
Versions: 7
Compression:
Stored size: 1008 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, self.error end end end def app Rack::Builder.app do use Grape::Middleware::Error, :default_message => 'Aww, hamburgers.' run ErrApp end end it 'should set the status code appropriately' do ErrApp.error = {:status => 410} get '/' last_response.status.should == 410 end it 'should set the error message appropriately' do ErrApp.error = {:message => 'Awesome stuff.'} get '/' last_response.body.should == 'Awesome stuff.' end it 'should default to a 403 status' do ErrApp.error = {} get '/' last_response.status.should == 403 end it 'should have a default message' do ErrApp.error = {} get '/' last_response.body.should == 'Aww, hamburgers.' end context 'with formatting' do end end
Version data entries
7 entries across 7 versions & 2 rubygems