summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-04-02 15:08:01 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-04-02 15:08:01 +0000
commit53b1f4eaa2a451aaba908a5fee7ce97a930021ac (patch)
tree66501ec0de9f529ee1cfc7cd6c4b481b1fc76662 /spec
parent684d65316ac77c62f47d68b9926eea8af30db227 (diff)
downloadgitlab-ce-53b1f4eaa2a451aaba908a5fee7ce97a930021ac.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec')
-rw-r--r--spec/lib/gitlab/git/remote_mirror_spec.rb4
-rw-r--r--spec/lib/gitlab/gitaly_client/remote_service_spec.rb2
-rw-r--r--spec/models/award_emoji_spec.rb16
-rw-r--r--spec/models/concerns/issuable_spec.rb3
-rw-r--r--spec/models/remote_mirror_spec.rb20
5 files changed, 40 insertions, 5 deletions
diff --git a/spec/lib/gitlab/git/remote_mirror_spec.rb b/spec/lib/gitlab/git/remote_mirror_spec.rb
index 9744562b51b..edef91b8bc6 100644
--- a/spec/lib/gitlab/git/remote_mirror_spec.rb
+++ b/spec/lib/gitlab/git/remote_mirror_spec.rb
@@ -7,14 +7,14 @@ describe Gitlab::Git::RemoteMirror do
let(:project) { create(:project, :repository) }
let(:repository) { project.repository }
let(:ref_name) { 'foo' }
- let(:options) { { only_branches_matching: ['master'], ssh_key: 'KEY', known_hosts: 'KNOWN HOSTS' } }
+ let(:options) { { only_branches_matching: ['master'], ssh_key: 'KEY', known_hosts: 'KNOWN HOSTS', keep_divergent_refs: true } }
subject(:remote_mirror) { described_class.new(repository, ref_name, **options) }
it 'delegates to the Gitaly client' do
expect(repository.gitaly_remote_client)
.to receive(:update_remote_mirror)
- .with(ref_name, ['master'], ssh_key: 'KEY', known_hosts: 'KNOWN HOSTS')
+ .with(ref_name, ['master'], ssh_key: 'KEY', known_hosts: 'KNOWN HOSTS', keep_divergent_refs: true)
remote_mirror.update
end
diff --git a/spec/lib/gitlab/gitaly_client/remote_service_spec.rb b/spec/lib/gitlab/gitaly_client/remote_service_spec.rb
index 2658414d9b0..2bddec739fc 100644
--- a/spec/lib/gitlab/gitaly_client/remote_service_spec.rb
+++ b/spec/lib/gitlab/gitaly_client/remote_service_spec.rb
@@ -66,7 +66,7 @@ describe Gitlab::GitalyClient::RemoteService do
.with(kind_of(Enumerator), kind_of(Hash))
.and_return(double(:update_remote_mirror_response))
- client.update_remote_mirror(ref_name, only_branches_matching, ssh_key: ssh_key, known_hosts: known_hosts)
+ client.update_remote_mirror(ref_name, only_branches_matching, ssh_key: ssh_key, known_hosts: known_hosts, keep_divergent_refs: true)
end
end
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