From 882d2fb4b22ad96882fd64aba058fb639171a6e6 Mon Sep 17 00:00:00 2001 From: Kyle Drake Date: Wed, 26 Oct 2016 21:34:53 -0500 Subject: [PATCH] fix for api 404 --- app.rb | 1 + tests/api_tests.rb | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/app.rb b/app.rb index 1a79a5b6..08a24929 100644 --- a/app.rb +++ b/app.rb @@ -39,6 +39,7 @@ before do end not_found do + api_not_found if @api @title = 'Not Found' erb :'not_found' end diff --git a/tests/api_tests.rb b/tests/api_tests.rb index 4a26dde8..b4f83821 100644 --- a/tests/api_tests.rb +++ b/tests/api_tests.rb @@ -14,6 +14,15 @@ def create_site(opts={}) @pass = site_attr[:password] end +describe 'api not found' do + it 'returns json for missing route' do + get '/api/sdlfkjsdlfjds' + last_response.status.must_equal 404 + res[:result].must_equal 'error' + res[:error_type].must_equal 'not_found' + end +end + describe 'api list' do it 'returns all files without path' do create_site