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.

19 lines
585 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. expect(SlackMathbot::Commands::Base).to receive(:send_message).with(channel, expected)
  8. app.send(:message, text: message, channel: channel, user: user)
  9. true
  10. end
  11. private
  12. def parse(actual)
  13. actual = { message: actual } unless actual.is_a?(Hash)
  14. [actual[:channel] || 'channel', actual[:user] || 'user', actual[:message]]
  15. end
  16. end