diff --git a/lib/app.rb b/lib/app.rb index 99bcd00..82328ac 100644 --- a/lib/app.rb +++ b/lib/app.rb @@ -33,7 +33,7 @@ class App < Sinatra::Base # A custom 404 page # not_found do - JSON.dump(error: 'not found') + JSON.dump(error: 'not found', status: 404, description: 'Document not found') end # diff --git a/spec/lib/app_spec.rb b/spec/lib/app_spec.rb index 090311b..ee008a6 100644 --- a/spec/lib/app_spec.rb +++ b/spec/lib/app_spec.rb @@ -102,7 +102,9 @@ def show_backtrace(response) } expect(last_response.status).to eq 404 expect(last_response.content_type).to eq 'application/json' - expect(JSON.parse(last_response.body)).to be_a Hash + expect(JSON.parse(last_response.body)).to match( + { "status" => 404, "description" => "Document not found", "error" => "not found" } + ) expect(Colore::Sidekiq::ConversionWorker).not_to have_received(:perform_async) end end