Comments (8)
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.
from slack-ruby-bot.
I think the issue is simpler here. You are calling StartIntegrationTestsWorker.perform_async
, which is a class method on StartIntegrationTestsWorker
, not an instance method. The above expect_any_instance_of
is expecting an instance, StartIntegrationTestsWorker.new
, and so doesn't work.
The expect(StartIntegrationTestsWorker).to receive(:perform_async)
version should work. Are you sure it does not?
from slack-ruby-bot.
The start_typing
, and respond_with_slack_message
and other rspec matchers setup a message handler/hook instance that in a real app is setup listening on slack's message events, and keep track of the client
instance, so you don't have to.
from slack-ruby-bot.
Minor, but I don't remember if we handle commands with spaces, run tests
. If it doesn't work try without?
from slack-ruby-bot.
I started with expect(StartIntegrationTestsWorker).to receive(:perform_async)
and have also tried expect(StartIntegrationTestsWorker).to receive(:perform)
in case ruby magic was translating it internally!
Both fail with
(StartIntegrationTestsWorker (class)).perform(*(any args))
expected: 1 time with any arguments
received: 0 times with any arguments
This is actually working nicely in Slack!
If I take out the StartIntegrationTestsWorker
line the start_typing(channel: 'channel')
test passes fine 🤔
Thanks for the response and clarification, knowing that it should work, I'll keep playing!
Thanks for maintaining all these repos!
from slack-ruby-bot.
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?
failing, but something like
it 'triggers the sidekiq job' do
expect { SlackRubyBot::Hooks::Message.new(message: user_input, channel: 'channel') }
.to change(MonitorTestRunWorker.jobs, :size).by(1)
end
from slack-ruby-bot.
If I take out the
StartIntegrationTestsWorker
line thestart_typing(channel: 'channel')
test passes fine 🤔
Is this code valid at all? Add a puts
above to see if it's called? Then wrap it in an exception handler, maybe there's a typo? :)
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?
from slack-ruby-bot.
Can I call message_send in a block?
failing, but something likeit 'triggers the sidekiq job' do expect { SlackRubyBot::Hooks::Message.new(message: user_input, channel: 'channel') } .to change(MonitorTestRunWorker.jobs, :size).by(1) end
yes you can
from slack-ruby-bot.
Related Issues (20)
- Getting lots of 429 rate limit errors on https://slack.com/api/rtm.start calls HOT 7
- Graceful shutdown HOT 1
- Deployment tutorial needs update HOT 2
- DMing self produces Sorry @Slackbot, I don't understand that command! HOT 1
- Migration to non-legacy bots HOT 6
- Consider splitting RSpec shared behaviours and development dependencies HOT 4
- Where can i find more info on the client.say method? HOT 7
- Remove support for Giphy
- Extract attachments text
- without mention in channel bot can't reply HOT 1
- Upload a file? HOT 1
- Pongbot does not run on linux mint 19 HOT 4
- Testing for two outputs from a command HOT 5
- When a command is posted in thread, its again posted as direct message automatically HOT 4
- is there an example for how to implement a conversational bot using slack-ruby-bot? HOT 1
- Missing concurrency - Add faye-websocket to your gemfile -- It's already in my Gemfile HOT 1
- Clarification of MIGRATION.md HOT 8
- Is this repo really legacy, there is still a use case? HOT 3
- Repeated 429 (ratelimited) errors from slack HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from slack-ruby-bot.