grape-appsignal 0.4.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/grape-appsignal/middleware.rb +1 -1
- data/lib/grape-appsignal/version.rb +1 -1
- data/spec/grape-appsignal/middleware_spec.rb +25 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7bacb69629bb0ce1b5d12fe5b7530f6e3b0da479
|
4
|
+
data.tar.gz: 39df3b28bb87097d8a32d2a9d4bdba7f5a48187f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fcfce259d320d53a1743b25eb7c8aa8355171f40e8afbb3b26c8dac30e3dea285d12840f3e1f917002c07a74abdb9f6704f200acc37c725bb563e283bcd5fbd8
|
7
|
+
data.tar.gz: 8cc64653b024fea9229daa715dfbf66483b431f0d262970a6fb4fc48a8580443f7348ff177c486578a3550230eb2cf386e221bf1bedb33007f33eae0e278102b
|
@@ -14,9 +14,9 @@ module Appsignal
|
|
14
14
|
|
15
15
|
api_endpoint = env['api.endpoint']
|
16
16
|
|
17
|
-
puts api_endpoint.method_name
|
18
17
|
|
19
18
|
method_name = api_endpoint.method_name.gsub(/ ?[ \/]/, '/') if api_endpoint && api_endpoint.method_name
|
19
|
+
method_name = method_name.gsub(/\/\//, '/') if method_name
|
20
20
|
|
21
21
|
request_path = api_endpoint.routes.first.route_path[1..-1].sub(/\(\.:format\)\z/, "")
|
22
22
|
|
@@ -1,5 +1,4 @@
|
|
1
1
|
require 'spec_helper'
|
2
|
-
|
3
2
|
describe Appsignal::Grape::Middleware do
|
4
3
|
|
5
4
|
class ComplexAPI < Grape::API
|
@@ -11,6 +10,9 @@ describe Appsignal::Grape::Middleware do
|
|
11
10
|
get 'name/:name' do
|
12
11
|
"hello #{params['name']}"
|
13
12
|
end
|
13
|
+
get '/goodbye' do
|
14
|
+
"hello #{params['name']}"
|
15
|
+
end
|
14
16
|
end
|
15
17
|
end
|
16
18
|
|
@@ -88,5 +90,27 @@ describe Appsignal::Grape::Middleware do
|
|
88
90
|
expect(subject.status).to eq(200)
|
89
91
|
end
|
90
92
|
end
|
93
|
+
|
94
|
+
context "with a complex API" do
|
95
|
+
let(:events){ [] }
|
96
|
+
let(:app){ ComplexAPI }
|
97
|
+
before do
|
98
|
+
ActiveSupport::Notifications.subscribe(/^[^!]/) do |*args|
|
99
|
+
events << ActiveSupport::Notifications::Event.new(*args)
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
subject { get "/api/v1/hello/goodbye/"; events.last}
|
104
|
+
|
105
|
+
it "delivers a payload consistent with the API call."do
|
106
|
+
expect(subject.payload ).to eq(
|
107
|
+
{ method: "GET" , path: "api/:version/hello/goodbye", action: "Grape(v1)(api)::GET/hello/goodbye", class: "API"}
|
108
|
+
)
|
109
|
+
end
|
110
|
+
|
111
|
+
it "names the payload consistent with the API call."do
|
112
|
+
expect(subject.name ).to eq("process_action.grape.GET.api.version.hello.goodbye")
|
113
|
+
end
|
114
|
+
end
|
91
115
|
end
|
92
116
|
end
|