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.

25 lines
916 B

  1. require 'spec_helper'
  2. describe SlackMathbot::Commands::Calculate, vcr: { cassette_name: 'user_info' } do
  3. def app
  4. SlackMathbot::App.new
  5. end
  6. before do
  7. app.config.user = 'mathbot'
  8. end
  9. it 'adds two numbers' do
  10. expect(message: 'mathbot calculate 2+2', channel: 'channel').to respond_with_slack_message('4')
  11. end
  12. it 'adds two numbers via =' do
  13. expect(message: '= 2+2', channel: 'channel').to respond_with_slack_message('4')
  14. end
  15. it 'adds two numbers via = without a space' do
  16. expect(message: '=2+2', channel: 'channel').to respond_with_slack_message('4')
  17. end
  18. it 'sends something without an answer' do
  19. expect(message: 'mathbot calculate pi', channel: 'channel').to respond_with_slack_message('Got nothing.')
  20. end
  21. it 'reports division by zero' do
  22. expect(message: 'mathbot calculate 1/0', channel: 'channel').to respond_with_slack_message('Sorry, divided by 0.')
  23. end
  24. end