diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-02 18:08:01 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-02 18:08:01 +0300 |
commit | 53b1f4eaa2a451aaba908a5fee7ce97a930021ac (patch) | |
tree | 66501ec0de9f529ee1cfc7cd6c4b481b1fc76662 /spec/models | |
parent | 684d65316ac77c62f47d68b9926eea8af30db227 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/models')
-rw-r--r-- | spec/models/award_emoji_spec.rb | 16 | ||||
-rw-r--r-- | spec/models/concerns/issuable_spec.rb | 3 | ||||
-rw-r--r-- | spec/models/remote_mirror_spec.rb | 20 |
3 files changed, 37 insertions, 2 deletions
diff --git a/spec/models/award_emoji_spec.rb b/spec/models/award_emoji_spec.rb index b2d58dd95ad..8b370e80c9b 100644 --- a/spec/models/award_emoji_spec.rb +++ b/spec/models/award_emoji_spec.rb @@ -41,6 +41,22 @@ describe AwardEmoji do expect(new_award).to be_valid end + + # Similar to allowing duplicate award emojis for ghost users, + # when Importing a project that has duplicate award emoji placed by + # ghost user we change the author to be importer user and allow + # duplicates, otherwise relation containing such duplicates + # fails to be created + context 'when importing' do + it 'allows duplicate award emoji' do + user = create(:user) + issue = create(:issue) + create(:award_emoji, user: user, awardable: issue) + new_award = build(:award_emoji, user: user, awardable: issue, importing: true) + + expect(new_award).to be_valid + end + end end end diff --git a/spec/models/concerns/issuable_spec.rb b/spec/models/concerns/issuable_spec.rb index 4ecbc671c72..cc1bb164c16 100644 --- a/spec/models/concerns/issuable_spec.rb +++ b/spec/models/concerns/issuable_spec.rb @@ -159,8 +159,7 @@ describe Issuable do end it 'returns issues with a partially matching description' do - expect(issuable_class.full_search(searchable_issue.description)) - .to eq([searchable_issue]) + expect(issuable_class.full_search('cut')).to eq([searchable_issue]) end it 'returns issues with a matching description regardless of the casing' do diff --git a/spec/models/remote_mirror_spec.rb b/spec/models/remote_mirror_spec.rb index f5e718e0e09..15b162ae87a 100644 --- a/spec/models/remote_mirror_spec.rb +++ b/spec/models/remote_mirror_spec.rb @@ -142,6 +142,26 @@ describe RemoteMirror, :mailer do end end + describe '#update_repository' do + let(:git_remote_mirror) { spy } + + before do + stub_const('Gitlab::Git::RemoteMirror', git_remote_mirror) + end + + it 'includes the `keep_divergent_refs` setting' do + mirror = build_stubbed(:remote_mirror, keep_divergent_refs: true) + + mirror.update_repository({}) + + expect(git_remote_mirror).to have_received(:new).with( + anything, + mirror.remote_name, + hash_including(keep_divergent_refs: true) + ) + end + end + describe '#safe_url' do context 'when URL contains credentials' do it 'masks the credentials' do |