Skip to content

Commit 2ba200a

Browse files
committed
Add body_metadata to expected keys in instrumentation payload
1 parent de05d14 commit 2ba200a

File tree

1 file changed

+36
-18
lines changed

1 file changed

+36
-18
lines changed

spec/grape/endpoint_spec.rb

Lines changed: 36 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1067,54 +1067,72 @@ def memoized
10671067
expect(@events).to contain_exactly(
10681068
have_attributes(name: 'endpoint_run_filters.grape', payload: { endpoint: a_kind_of(described_class),
10691069
filters: a_collection_containing_exactly(an_instance_of(Proc)),
1070-
type: :before }),
1070+
type: :before,
1071+
body_metadata: a_kind_of(Hash) }),
10711072
have_attributes(name: 'endpoint_run_filters.grape', payload: { endpoint: a_kind_of(described_class),
10721073
filters: [],
1073-
type: :before_validation }),
1074+
type: :before_validation,
1075+
body_metadata: a_kind_of(Hash) }),
10741076
have_attributes(name: 'endpoint_run_validators.grape', payload: { endpoint: a_kind_of(described_class),
10751077
validators: [],
1076-
request: a_kind_of(Grape::Request) }),
1078+
request: a_kind_of(Grape::Request),
1079+
body_metadata: a_kind_of(Hash) }),
10771080
have_attributes(name: 'endpoint_run_filters.grape', payload: { endpoint: a_kind_of(described_class),
10781081
filters: [],
1079-
type: :after_validation }),
1080-
have_attributes(name: 'endpoint_render.grape', payload: { endpoint: a_kind_of(described_class) }),
1082+
type: :after_validation,
1083+
body_metadata: a_kind_of(Hash) }),
1084+
have_attributes(name: 'endpoint_render.grape', payload: { endpoint: a_kind_of(described_class),
1085+
body_metadata: a_kind_of(Hash) }),
10811086
have_attributes(name: 'endpoint_run_filters.grape', payload: { endpoint: a_kind_of(described_class),
10821087
filters: [],
1083-
type: :after }),
1088+
type: :after,
1089+
body_metadata: a_kind_of(Hash) }),
10841090
have_attributes(name: 'endpoint_run_filters.grape', payload: { endpoint: a_kind_of(described_class),
10851091
filters: [],
1086-
type: :finally }),
1092+
type: :finally,
1093+
body_metadata: a_kind_of(Hash) }),
10871094
have_attributes(name: 'endpoint_run.grape', payload: { endpoint: a_kind_of(described_class),
1088-
env: an_instance_of(Hash) }),
1095+
env: an_instance_of(Hash),
1096+
body_metadata: a_kind_of(Hash) }),
10891097
have_attributes(name: 'format_response.grape', payload: { env: an_instance_of(Hash),
1090-
formatter: a_kind_of(Module) })
1098+
formatter: a_kind_of(Module),
1099+
body_metadata: a_kind_of(Hash) })
10911100
)
10921101

10931102
# In order that events were initialized
10941103
expect(@events.sort_by(&:time)).to contain_exactly(
10951104
have_attributes(name: 'endpoint_run.grape', payload: { endpoint: a_kind_of(described_class),
1096-
env: an_instance_of(Hash) }),
1105+
env: an_instance_of(Hash),
1106+
body_metadata: a_kind_of(Hash) }),
10971107
have_attributes(name: 'endpoint_run_filters.grape', payload: { endpoint: a_kind_of(described_class),
10981108
filters: a_collection_containing_exactly(an_instance_of(Proc)),
1099-
type: :before }),
1109+
type: :before,
1110+
body_metadata: a_kind_of(Hash) }),
11001111
have_attributes(name: 'endpoint_run_filters.grape', payload: { endpoint: a_kind_of(described_class),
11011112
filters: [],
1102-
type: :before_validation }),
1113+
type: :before_validation,
1114+
body_metadata: a_kind_of(Hash) }),
11031115
have_attributes(name: 'endpoint_run_validators.grape', payload: { endpoint: a_kind_of(described_class),
11041116
validators: [],
1105-
request: a_kind_of(Grape::Request) }),
1117+
request: a_kind_of(Grape::Request),
1118+
body_metadata: a_kind_of(Hash) }),
11061119
have_attributes(name: 'endpoint_run_filters.grape', payload: { endpoint: a_kind_of(described_class),
11071120
filters: [],
1108-
type: :after_validation }),
1109-
have_attributes(name: 'endpoint_render.grape', payload: { endpoint: a_kind_of(described_class) }),
1121+
type: :after_validation,
1122+
body_metadata: a_kind_of(Hash) }),
1123+
have_attributes(name: 'endpoint_render.grape', payload: { endpoint: a_kind_of(described_class),
1124+
body_metadata: a_kind_of(Hash) }),
11101125
have_attributes(name: 'endpoint_run_filters.grape', payload: { endpoint: a_kind_of(described_class),
11111126
filters: [],
1112-
type: :after }),
1127+
type: :after,
1128+
body_metadata: a_kind_of(Hash) }),
11131129
have_attributes(name: 'endpoint_run_filters.grape', payload: { endpoint: a_kind_of(described_class),
11141130
filters: [],
1115-
type: :finally }),
1131+
type: :finally,
1132+
body_metadata: a_kind_of(Hash) }),
11161133
have_attributes(name: 'format_response.grape', payload: { env: an_instance_of(Hash),
1117-
formatter: a_kind_of(Module) })
1134+
formatter: a_kind_of(Module),
1135+
body_metadata: a_kind_of(Hash) })
11181136
)
11191137
end
11201138
end

0 commit comments

Comments
 (0)