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.

32 lines
895 B

  1. require 'spec_helper'
  2. describe SlackMathbot::App do
  3. subject do
  4. SlackMathbot::App.new
  5. end
  6. context 'not configured' do
  7. before do
  8. @slack_api_token = ENV.delete('SLACK_API_TOKEN')
  9. end
  10. after do
  11. ENV['SLACK_API_TOKEN'] = @slack_api_token
  12. end
  13. it 'requires SLACK_API_TOKEN' do
  14. expect { subject }.to raise_error RuntimeError, "Missing ENV['SLACK_API_TOKEN']."
  15. end
  16. end
  17. context 'configured', vcr: { cassette_name: 'auth_test' } do
  18. context 'run' do
  19. before do
  20. subject.send(:auth!)
  21. end
  22. it 'succeeds auth' do
  23. expect(subject.config.url).to eq 'https://math.slack.com/'
  24. expect(subject.config.team).to eq 'calcteam'
  25. expect(subject.config.user).to eq 'calcuser'
  26. expect(subject.config.team_id).to eq 'TDEADBEEF'
  27. expect(subject.config.user_id).to eq 'UBAADFOOD'
  28. end
  29. end
  30. end
  31. end