-
-
Notifications
You must be signed in to change notification settings - Fork 187
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Testing other code execution inside a command #247
Comments
I think the issue is simpler here. You are calling The |
The |
Minor, but I don't remember if we handle commands with spaces, |
Hmm, looking at my other tests, I am using a different format expect { perform }.to change(MonitorTestRunWorker.jobs, :size).by(1) In the same tests it 'works?' do
expect(MonitorTestRunWorker).to receive(:perform)
perform
end fails. Can I call message_send in a block? it 'triggers the sidekiq job' do
expect { SlackRubyBot::Hooks::Message.new(message: user_input, channel: 'channel') }
.to change(MonitorTestRunWorker.jobs, :size).by(1)
end |
Is this code valid at all? Add a command 'run tests' do |client, data, _match|
begin
client.typing(channel: data.channel)
StartIntegrationTestsWorker.perform_async(data)
rescue Exception => e
puts e
raise
end
end See anything? |
yes you can |
If you're still having trouble, feel free to upload the project somewhere and I can try to help. Either way this is 100% not a problem with the bot library, I'm going to close this for housekeeping, but feel free to add more questions and I'll do my best to answer. |
So I have a simple command that shows the user a typing message while queuing a sidekiq job that processes a long running task and outputs further details...
My simple test ensures that start_typing is received..
Is there a way to successfully test the execution of code other than the chat message?
This all works in reality, but despite trying the above and...
expect(StartIntegrationTestsWorker).to receive(:perform_async)
and other varieties I cannot successfully get the tests to simulate calling the
StartIntegrationTestsWorker
.Do the
start_typing
,respond_with_slack_message
and other rspec matchers mock out the entire process? If so, is there a guide anywhere for testing other code handling inside commands?The text was updated successfully, but these errors were encountered: