diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-06-16 21:25:58 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-06-16 21:25:58 +0300 |
commit | a5f4bba440d7f9ea47046a0a561d49adf0a1e6d4 (patch) | |
tree | fb69158581673816a8cd895f9d352dcb3c678b1e /spec/services/users/update_assigned_open_issue_count_service_spec.rb | |
parent | d16b2e8639e99961de6ddc93909f3bb5c1445ba1 (diff) |
Add latest changes from gitlab-org/gitlab@14-0-stable-eev14.0.0-rc42
Diffstat (limited to 'spec/services/users/update_assigned_open_issue_count_service_spec.rb')
-rw-r--r-- | spec/services/users/update_assigned_open_issue_count_service_spec.rb | 49 |
1 files changed, 0 insertions, 49 deletions
diff --git a/spec/services/users/update_assigned_open_issue_count_service_spec.rb b/spec/services/users/update_assigned_open_issue_count_service_spec.rb deleted file mode 100644 index 55fc60a7893..00000000000 --- a/spec/services/users/update_assigned_open_issue_count_service_spec.rb +++ /dev/null @@ -1,49 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' - -RSpec.describe Users::UpdateAssignedOpenIssueCountService do - let_it_be(:user) { create(:user) } - - describe '#initialize' do - context 'incorrect arguments provided' do - it 'raises an error if there are no target user' do - expect { described_class.new(target_user: nil) }.to raise_error(ArgumentError, /Please provide a target user/) - expect { described_class.new(target_user: "nonsense") }.to raise_error(ArgumentError, /Please provide a target user/) - end - end - - context 'when correct arguments provided' do - it 'is successful' do - expect { described_class.new(target_user: user) }.not_to raise_error - end - end - end - - describe "#execute", :clean_gitlab_redis_cache do - let(:fake_update_service) { double } - let(:fake_issue_count_service) { double } - let(:provided_value) { nil } - - subject { described_class.new(target_user: user).execute } - - context 'successful' do - it 'returns a success response' do - expect(subject).to be_success - end - - it 'writes the cache with the new value' do - expect(Rails.cache).to receive(:write).with(['users', user.id, 'assigned_open_issues_count'], 0, expires_in: User::COUNT_CACHE_VALIDITY_PERIOD) - - subject - end - - it 'calls the issues finder to get the latest value' do - expect(IssuesFinder).to receive(:new).with(user, assignee_id: user.id, state: 'opened', non_archived: true).and_return(fake_issue_count_service) - expect(fake_issue_count_service).to receive(:execute) - - subject - end - end - end -end |