diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-07-20 15:26:25 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-07-20 15:26:25 +0300 |
commit | a09983ae35713f5a2bbb100981116d31ce99826e (patch) | |
tree | 2ee2af7bd104d57086db360a7e6d8c9d5d43667a /spec/models/issue_spec.rb | |
parent | 18c5ab32b738c0b6ecb4d0df3994000482f34bd8 (diff) |
Add latest changes from gitlab-org/gitlab@13-2-stable-ee
Diffstat (limited to 'spec/models/issue_spec.rb')
-rw-r--r-- | spec/models/issue_spec.rb | 51 |
1 files changed, 27 insertions, 24 deletions
diff --git a/spec/models/issue_spec.rb b/spec/models/issue_spec.rb index 291cccd72db..80041d2e859 100644 --- a/spec/models/issue_spec.rb +++ b/spec/models/issue_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Issue do +RSpec.describe Issue do include ExternalAuthorizationServiceHelpers describe "Associations" do @@ -95,29 +95,6 @@ describe Issue do end end - describe 'locking' do - using RSpec::Parameterized::TableSyntax - - where(:lock_version) do - [ - [0], - ["0"] - ] - end - - with_them do - it 'works when an issue has a NULL lock_version' do - issue = create(:issue) - - described_class.where(id: issue.id).update_all('lock_version = NULL') - - issue.update!(lock_version: lock_version, title: 'locking test') - - expect(issue.reload.title).to eq('locking test') - end - end - end - describe '.simple_sorts' do it 'includes all keys' do expect(described_class.simple_sorts.keys).to include( @@ -406,6 +383,22 @@ describe Issue do end end + describe '#from_service_desk?' do + subject { issue.from_service_desk? } + + context 'when issue author is support bot' do + let(:issue) { create(:issue, author: ::User.support_bot) } + + it { is_expected.to be_truthy } + end + + context 'when issue author is not support bot' do + let(:issue) { create(:issue) } + + it { is_expected.to be_falsey } + end + end + describe '#suggested_branch_name' do let(:repository) { double } @@ -1002,6 +995,16 @@ describe Issue do end end + describe '.service_desk' do + it 'returns the service desk issue' do + service_desk_issue = create(:issue, author: ::User.support_bot) + regular_issue = create(:issue) + + expect(described_class.service_desk).to include(service_desk_issue) + expect(described_class.service_desk).not_to include(regular_issue) + end + end + it_behaves_like 'throttled touch' do subject { create(:issue, updated_at: 1.hour.ago) } end |