Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/services/chat_names/find_user_service_spec.rb')
-rw-r--r--spec/services/chat_names/find_user_service_spec.rb20
1 files changed, 10 insertions, 10 deletions
diff --git a/spec/services/chat_names/find_user_service_spec.rb b/spec/services/chat_names/find_user_service_spec.rb
index 4b0a1204558..10cb0a2f065 100644
--- a/spec/services/chat_names/find_user_service_spec.rb
+++ b/spec/services/chat_names/find_user_service_spec.rb
@@ -4,17 +4,16 @@ require 'spec_helper'
RSpec.describe ChatNames::FindUserService, :clean_gitlab_redis_shared_state do
describe '#execute' do
- let(:integration) { create(:integration) }
-
- subject { described_class.new(integration, params).execute }
+ subject { described_class.new(team_id, user_id).execute }
context 'find user mapping' do
- let(:user) { create(:user) }
- let!(:chat_name) { create(:chat_name, user: user, integration: integration) }
+ let_it_be(:user) { create(:user) }
+ let_it_be(:chat_name) { create(:chat_name, user: user) }
- context 'when existing user is requested' do
- let(:params) { { team_id: chat_name.team_id, user_id: chat_name.chat_id } }
+ let(:team_id) { chat_name.team_id }
+ let(:user_id) { chat_name.chat_id }
+ context 'when existing user is requested' do
it 'returns the existing chat_name' do
is_expected.to eq(chat_name)
end
@@ -28,7 +27,8 @@ RSpec.describe ChatNames::FindUserService, :clean_gitlab_redis_shared_state do
end
it 'only updates an existing timestamp once within a certain time frame' do
- service = described_class.new(integration, params)
+ chat_name = create(:chat_name, user: user)
+ service = described_class.new(team_id, user_id)
expect(chat_name.last_used_at).to be_nil
@@ -43,9 +43,9 @@ RSpec.describe ChatNames::FindUserService, :clean_gitlab_redis_shared_state do
end
context 'when different user is requested' do
- let(:params) { { team_id: chat_name.team_id, user_id: 'non-existing-user' } }
+ let(:user_id) { 'non-existing-user' }
- it 'returns existing user' do
+ it 'returns nil' do
is_expected.to be_nil
end
end