spec/datadog/notifications/plugins/grape_spec.rb in datadog-notifications-0.5.4 vs spec/datadog/notifications/plugins/grape_spec.rb in datadog-notifications-0.6.0

- old
+ new

@@ -8,32 +8,32 @@ sub_api = Class.new(Grape::API) do version 'v1' prefix 'api' - get('versioned') { "OK" } + get('versioned') { 'OK' } end Class.new(Grape::API) do rescue_from unauthorized do |_e| - error!({ message: "unauthorized", error: '401 Unauthorized' }, 401) + error!({ message: 'unauthorized', error: '401 Unauthorized' }, 401) end get 'echo/:key1/:key2' do "#{params['key1']} #{params['key2']}" end get '/rescued' do - raise unauthorized, "unauthorized" + raise unauthorized, 'unauthorized' end namespace :sub do mount sub_api namespace :secure do - get("/resource") { error!("forbidden", 403) } + get('/resource') { error!('forbidden', 403) } end end end end @@ -41,54 +41,54 @@ get '/echo/1/1234' expect(last_response.status).to eq(200) expect(last_response.body).to eq('1 1234') expect(buffered).to eq([ - "api.request:1|c|#custom:tag,env:test,host:test.host,more:tags,method:GET,status:200,path:/echo/KEY1/KEY2", - "api.request.time:333|ms|#custom:tag,env:test,host:test.host,more:tags,method:GET,status:200,path:/echo/KEY1/KEY2", - ],) + 'api.request:1|c|#custom:tag,env:test,host:test.host,more:tags,method:GET,status:200,path:/echo/KEY1/KEY2', + 'api.request.time:333|ms|#custom:tag,env:test,host:test.host,more:tags,method:GET,status:200,path:/echo/KEY1/KEY2', + ]) end it 'should support namespaces and versioning' do get '/api/v1/sub/versioned.txt' expect(last_response.status).to eq(200) expect(last_response.body).to eq('OK') expect(buffered).to eq([ - "api.request:1|c|#custom:tag,env:test,host:test.host,more:tags,method:GET,status:200,path:/api/sub/versioned,version:v1", - "api.request.time:333|ms|#custom:tag,env:test,host:test.host,more:tags,method:GET,status:200,path:/api/sub/versioned,version:v1", - ],) + 'api.request:1|c|#custom:tag,env:test,host:test.host,more:tags,method:GET,status:200,path:/api/sub/versioned,version:v1', + 'api.request.time:333|ms|#custom:tag,env:test,host:test.host,more:tags,method:GET,status:200,path:/api/sub/versioned,version:v1', + ]) end it 'should support deep nesting' do get '/sub/secure/resource' expect(last_response.status).to eq(403) expect(last_response.body).to eq('forbidden') expect(buffered).to eq([ - "api.request:1|c|#custom:tag,env:test,host:test.host,more:tags,method:GET,status:403,path:/sub/secure/resource", - "api.request.time:333|ms|#custom:tag,env:test,host:test.host,more:tags,method:GET,status:403,path:/sub/secure/resource", - ],) + 'api.request:1|c|#custom:tag,env:test,host:test.host,more:tags,method:GET,status:403,path:/sub/secure/resource', + 'api.request.time:333|ms|#custom:tag,env:test,host:test.host,more:tags,method:GET,status:403,path:/sub/secure/resource', + ]) end it 'should handle rescued errors' do get '/rescued' expect(last_response.status).to eq(401) expect(buffered).to eq([ - "api.request:1|c|#custom:tag,env:test,host:test.host,more:tags,method:GET,status:401,path:/rescued", - "api.request.time:333|ms|#custom:tag,env:test,host:test.host,more:tags,method:GET,status:401,path:/rescued", - ],) + 'api.request:1|c|#custom:tag,env:test,host:test.host,more:tags,method:GET,status:401,path:/rescued', + 'api.request.time:333|ms|#custom:tag,env:test,host:test.host,more:tags,method:GET,status:401,path:/rescued', + ]) end it 'should handle invalid method' do post '/rescued' expect(last_response.status).to eq(405) expect(buffered).to eq([ - "api.request:1|c|#custom:tag,env:test,host:test.host,more:tags,method:POST,status:405,path:/rescued", - "api.request.time:333|ms|#custom:tag,env:test,host:test.host,more:tags,method:POST,status:405,path:/rescued", - ],) + 'api.request:1|c|#custom:tag,env:test,host:test.host,more:tags,method:POST,status:405,path:/rescued', + 'api.request.time:333|ms|#custom:tag,env:test,host:test.host,more:tags,method:POST,status:405,path:/rescued', + ]) end it 'should not report paths on 404s' do get '/sub/missing' expect(last_response.status).to eq(404)