summaryrefslogtreecommitdiff
path: root/spec/services/chat_names/authorize_user_service_spec.rb
blob: d88b2504133be26396d64f901451d15fcabfc5a8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
require 'spec_helper'

describe ChatNames::AuthorizeUserService do
  describe '#execute' do
    let(:service) { create(:service) }

    subject { described_class.new(service, params).execute }

    context 'when all parameters are valid' do
      let(:params) { { team_id: 'T0001', team_domain: 'myteam', user_id: 'U0001', user_name: 'user' } }

      it 'requests a new token' do
        is_expected.to be_url
      end
    end

    context 'when there are missing parameters' do
      let(:params) { {} }

      it 'does not request a new token' do
        is_expected.to be_nil
      end
    end
  end
end