A Slack Bot that pulls Pixiv information and posts the full image(s) into Slack, with iOS shortcuts.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
622 B

  1. require 'rspec/expectations'
  2. RSpec::Matchers.define :respond_with_slack_message do |expected|
  3. match do |actual|
  4. channel, user, message = parse(actual)
  5. app = SlackMathbot::App.new
  6. SlackMathbot.config.user = 'mathbot'
  7. allow(Giphy).to receive(:random)
  8. expect(SlackMathbot::Commands::Base).to receive(:send_message).with(channel, expected)
  9. app.send(:message, text: message, channel: channel, user: user)
  10. true
  11. end
  12. private
  13. def parse(actual)
  14. actual = { message: actual } unless actual.is_a?(Hash)
  15. [actual[:channel] || 'channel', actual[:user] || 'user', actual[:message]]
  16. end
  17. end