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

require 'rspec/expectations'
RSpec::Matchers.define :respond_with_slack_message do |expected|
match do |actual|
channel, user, message = parse(actual)
app = SlackMathbot::App.new
SlackMathbot.config.user = 'mathbot'
expect(SlackMathbot::Commands::Base).to receive(:send_message).with(channel, expected)
app.send(:message, text: message, channel: channel, user: user)
true
end
private
def parse(actual)
actual = { message: actual } unless actual.is_a?(Hash)
[actual[:channel] || 'channel', actual[:user] || 'user', actual[:message]]
end
end