diff options
author | Alex Kalderimis <akalderimis@gitlab.com> | 2019-08-30 04:43:16 +0000 |
---|---|---|
committer | Thong Kuah <tkuah@gitlab.com> | 2019-08-30 04:43:16 +0000 |
commit | e3a91089b75cdadaa66288d0ff68f137893a3a45 (patch) | |
tree | 5b90b14cbb888b193c70cf1f7402937275470506 /spec/services/chat_names | |
parent | 1a513aaf53d4f7b7c08aded24f1741e5906fba39 (diff) | |
download | gitlab-ce-e3a91089b75cdadaa66288d0ff68f137893a3a45.tar.gz |
Allow be_url to specify the type
This allows the be_url matcher to be more specific. By default, it only
matches HTTP and HTTPS URIs.
Diffstat (limited to 'spec/services/chat_names')
-rw-r--r-- | spec/services/chat_names/authorize_user_service_spec.rb | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/spec/services/chat_names/authorize_user_service_spec.rb b/spec/services/chat_names/authorize_user_service_spec.rb index 41cbac4e8e9..7f32948daad 100644 --- a/spec/services/chat_names/authorize_user_service_spec.rb +++ b/spec/services/chat_names/authorize_user_service_spec.rb @@ -4,23 +4,36 @@ require 'spec_helper' describe ChatNames::AuthorizeUserService do describe '#execute' do - let(:service) { create(:service) } + subject { described_class.new(service, params) } - subject { described_class.new(service, params).execute } + let(:result) { subject.execute } + let(:service) { create(:service) } context 'when all parameters are valid' do let(:params) { { team_id: 'T0001', team_domain: 'myteam', user_id: 'U0001', user_name: 'user' } } + it 'produces a valid HTTP URL' do + expect(result).to be_http_url + end + it 'requests a new token' do - is_expected.to be_url + expect(subject).to receive(:request_token).once.and_call_original + + subject.execute end end context 'when there are missing parameters' do let(:params) { {} } + it 'does not produce a URL' do + expect(result).to be_nil + end + it 'does not request a new token' do - is_expected.to be_nil + expect(subject).not_to receive(:request_token) + + subject.execute end end end |