Open IsabelleLePivain opened 1 year ago
Hi,
Here is another attempt I had: I tried the test with the full original payload from Slack:
{"token"=>"ourtoken123",
"team_id"=>"T04...",
"team_domain"=>"sosvdev",
"channel_id"=>"D04....",
"channel_name"=>"directmessage",
"user_id"=>"U04...",
"user_name"=>"isabelle.lepivain",
"command"=>"/help",
"text"=>"",
"api_app_id"=>"ABC...",
"is_enterprise_install"=>"false",
"response_url"=>"https...",
"trigger_id"=>"123..."}
I mimicked the params here, but in my code I have copy pasted the actual original payload from our test workspace. I also tried converting this hash into JSON. None of this seems to trigger the command from our tests.
Hello,
I am trying to test a Slash command by sending it an HTTP payload to the URL set for Slash commands for our app.
I used the ping command spec on the sample repository to build my test. The only impactful difference I can notice with my current test is that I skipped the team fabrication (it returned an error, and I am not clear with what it should be doing).
RSpec seems to load the library and configure Slash commands, but it looks like the command is not actually being run in my test. I already checked the route and it looks good.
I am not getting an error message. What happens is that RSpec seems to load the library and the command file properly and enter the
SlackRubyBotServer::Events.configure do |config|
scope. The post command does not return any error. But the code in theconfig.on :command, '/help' do |command|
block is not run.Here is the code of my Slash command. It is located under ./app/lib/slack/commands/help.rb
Here is the code of my Slash command. It is located under ./app/lib/slack/commands/help.rb
The only parameters that my Slash command uses from the payload are the trigger_id an the name of the command.
I am a beginner with both programming and RSpec. Apologies if there is any inaccuracy, or if this is an obvious question. I spent a couple of hours investigating without success.
Thank you!