Sha256: db314d0ed20feae93bbd3971a9cc92d9a0d63c4e156427669be44713f60f3412

Contents?: true

Size: 830 Bytes

Versions: 1

Compression:

Stored size: 830 Bytes

Contents

shared_examples 'a slack ruby bot' do
  context 'not configured' do
    before do
      @slack_api_token = ENV.delete('SLACK_API_TOKEN')
    end
    after do
      ENV['SLACK_API_TOKEN'] = @slack_api_token
    end
    it 'requires SLACK_API_TOKEN' do
      expect { subject }.to raise_error RuntimeError, "Missing ENV['SLACK_API_TOKEN']."
    end
  end
  context 'configured', vcr: { cassette_name: 'auth_test' } do
    context 'run' do
      before do
        subject.send(:auth!)
      end
      it 'succeeds auth' do
        expect(subject.config.url).to eq 'https://rubybot.slack.com/'
        expect(subject.config.team).to eq 'team'
        expect(subject.config.user).to eq 'user'
        expect(subject.config.team_id).to eq 'TDEADBEEF'
        expect(subject.config.user_id).to eq 'UBAADFOOD'
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
slack-ruby-bot-0.1.0 lib/slack-ruby-bot/rspec/support/slack-ruby-bot/it_behaves_like_a_slack_bot.rb