Commit 88ffb080 authored by GitLab Bot's avatar GitLab Bot

Automatic merge of gitlab-org/gitlab-ce master

parents 933b98c6 92855f2c
......@@ -24,16 +24,16 @@ module ChatNames
end
def chat_name_token
Gitlab::ChatNameToken.new
@chat_name_token ||= Gitlab::ChatNameToken.new
end
def chat_name_params
{
service_id: @service.id,
team_id: @params[:team_id],
service_id: @service.id,
team_id: @params[:team_id],
team_domain: @params[:team_domain],
chat_id: @params[:user_id],
chat_name: @params[:user_name]
chat_id: @params[:user_id],
chat_name: @params[:user_name]
}
end
end
......
......@@ -21,6 +21,9 @@ such as [#64870](https://gitlab.com/gitlab-org/gitlab-ce/issues/64870).
See all the related issues linked from this [issue's description](https://gitlab.com/gitlab-org/gitlab-ce/issues/28996)
for more information.
Note: **Note:**
Using this feature requires **2 IP addresses** to be configured to the machine.
## Requirements
Before you can enable automatic provisioning of a SSL certificate for your domain, make sure you have:
......
......@@ -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
......
# frozen_string_literal: true
RSpec::Matchers.define :be_url do |_|
# Assert that this value is a valid URL of at least one type.
#
# By default, this checks that the URL is either a HTTP or HTTPS URI,
# but you can check other URI schemes by passing the type, eg:
#
# ```
# expect(value).to be_url(URI::FTP)
# ```
#
# Pass an empty array of types if you want to match any URI scheme (be
# aware that this might not do what you think it does! `foo` is a valid
# URI, for instance).
RSpec::Matchers.define :be_url do |types = [URI::HTTP, URI::HTTPS]|
match do |actual|
URI.parse(actual) rescue false
next false unless actual.present?
uri = URI.parse(actual)
Array.wrap(types).any? { |t| uri.is_a?(t) }
rescue URI::InvalidURIError
false
end
end
# looks better when used like:
# expect(thing).to receive(:method).with(a_valid_url)
RSpec::Matchers.alias_matcher :a_valid_url, :be_url
RSpec::Matchers.alias_matcher :be_http_url, :be_url
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment