Skip to content

Commit 279b8d9

Browse files
committed
Adds test to confirm message_id getting passed
1 parent 7596e07 commit 279b8d9

1 file changed

Lines changed: 33 additions & 0 deletions

File tree

spec/lib/chatops/controller_spec.rb

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,13 @@
2525
jsonrpc_success "You just foo and bar like it just don't matter"
2626
end
2727

28+
chatop :proxy_parameters,
29+
/(?:proxy_parameters)/,
30+
"proxy parameters back to test" do
31+
response = { :params => params, :jsonrpc_params => jsonrpc_params }.to_json
32+
jsonrpc_success response
33+
end
34+
2835
skip_before_action :ensure_method_exists, only: :non_chatop_method
2936
def non_chatop_method
3037
render :plain => "Why would you have something thats not a chatop?"
@@ -228,6 +235,12 @@ def rails_flexible_post(path, outer_params, jsonrpc_params = nil)
228235
"regex" => /(?:how can i foo and bar all at once)?/.source,
229236
"params" => [],
230237
"path" => "foobar"
238+
},
239+
"proxy_parameters" => {
240+
"help" => "proxy parameters back to test",
241+
"regex" => /(?:proxy_parameters)/.source,
242+
"params" => [],
243+
"path" => "proxy_parameters"
231244
}
232245
},
233246
"version" => "3"
@@ -293,6 +306,26 @@ def rails_flexible_post(path, outer_params, jsonrpc_params = nil)
293306
expect(response.status).to eq 200
294307
end
295308

309+
it "passes all expected paramters" do
310+
rails_flexible_post :execute_chatop, {
311+
:chatop => "proxy_parameters",
312+
:user => "foo",
313+
:mention_slug => "mention_slug_here",
314+
:message_id => "message_id_here",
315+
:room_id => "#someroom",
316+
:unknown_key => "few" # This should get ignored
317+
}, {
318+
"app" => "foo"
319+
}
320+
expect(json_response).to eq({
321+
"jsonrpc" => "2.0",
322+
"id" => nil,
323+
"result" => "{\"params\":{\"action\":\"proxy_parameters\",\"chatop\":\"proxy_parameters\",\"controller\":\"anonymous\",\"mention_slug\":\"mention_slug_here\",\"message_id\":\"message_id_here\",\"room_id\":\"#someroom\",\"user\":\"foo\"},\"jsonrpc_params\":{\"app\":\"foo\"}}"
324+
})
325+
expect(response.status).to eq 200
326+
end
327+
328+
296329
it "uses typical controller fun like before_action" do
297330
rails_flexible_post :execute_chatop, :chatop => "wcid", :user => "foo"
298331
expect(json_response).to eq({

0 commit comments

Comments
 (0)