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:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-08-20 21:42:06 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-08-20 21:42:06 +0300
commit6e4e1050d9dba2b7b2523fdd1768823ab85feef4 (patch)
tree78be5963ec075d80116a932011d695dd33910b4e /spec/lib/gitlab/git
parent1ce776de4ae122aba3f349c02c17cebeaa8ecf07 (diff)
Add latest changes from gitlab-org/gitlab@13-3-stable-ee
Diffstat (limited to 'spec/lib/gitlab/git')
-rw-r--r--spec/lib/gitlab/git/branch_spec.rb1
-rw-r--r--spec/lib/gitlab/git/commit_spec.rb1
-rw-r--r--spec/lib/gitlab/git/conflict/parser_spec.rb3
-rw-r--r--spec/lib/gitlab/git/diff_collection_spec.rb2
-rw-r--r--spec/lib/gitlab/git/diff_spec.rb2
-rw-r--r--spec/lib/gitlab/git/patches/collection_spec.rb1
-rw-r--r--spec/lib/gitlab/git/patches/commit_patches_spec.rb1
-rw-r--r--spec/lib/gitlab/git/patches/patch_spec.rb1
-rw-r--r--spec/lib/gitlab/git/pre_receive_error_spec.rb16
-rw-r--r--spec/lib/gitlab/git/repository_spec.rb3
10 files changed, 28 insertions, 3 deletions
diff --git a/spec/lib/gitlab/git/branch_spec.rb b/spec/lib/gitlab/git/branch_spec.rb
index bac1b4c57f9..e1bcf4aeeb1 100644
--- a/spec/lib/gitlab/git/branch_spec.rb
+++ b/spec/lib/gitlab/git/branch_spec.rb
@@ -84,6 +84,7 @@ RSpec.describe Gitlab::Git::Branch, :seed_helper do
parents: parents
}
end
+
let(:stale_sha) { Timecop.freeze(Gitlab::Git::Branch::STALE_BRANCH_THRESHOLD.ago - 5.days) { create_commit } }
let(:active_sha) { Timecop.freeze(Gitlab::Git::Branch::STALE_BRANCH_THRESHOLD.ago + 5.days) { create_commit } }
let(:future_sha) { Timecop.freeze(100.days.since) { create_commit } }
diff --git a/spec/lib/gitlab/git/commit_spec.rb b/spec/lib/gitlab/git/commit_spec.rb
index 666b49f27f7..491437856d4 100644
--- a/spec/lib/gitlab/git/commit_spec.rb
+++ b/spec/lib/gitlab/git/commit_spec.rb
@@ -9,6 +9,7 @@ RSpec.describe Gitlab::Git::Commit, :seed_helper do
let(:rugged_repo) do
Rugged::Repository.new(File.join(TestEnv.repos_path, TEST_REPO_PATH))
end
+
let(:commit) { described_class.find(repository, SeedRepo::Commit::ID) }
let(:rugged_commit) { rugged_repo.lookup(SeedRepo::Commit::ID) }
diff --git a/spec/lib/gitlab/git/conflict/parser_spec.rb b/spec/lib/gitlab/git/conflict/parser_spec.rb
index 67bd48256ce..02b00f711b4 100644
--- a/spec/lib/gitlab/git/conflict/parser_spec.rb
+++ b/spec/lib/gitlab/git/conflict/parser_spec.rb
@@ -89,12 +89,15 @@ RSpec.describe Gitlab::Git::Conflict::Parser do
let(:lines) do
described_class.parse(text, our_path: 'files/ruby/regex.rb', their_path: 'files/ruby/regex.rb')
end
+
let(:old_line_numbers) do
lines.select { |line| line[:type] != 'new' }.map { |line| line[:line_old] }
end
+
let(:new_line_numbers) do
lines.select { |line| line[:type] != 'old' }.map { |line| line[:line_new] }
end
+
let(:line_indexes) { lines.map { |line| line[:line_obj_index] } }
it 'sets our lines as new lines' do
diff --git a/spec/lib/gitlab/git/diff_collection_spec.rb b/spec/lib/gitlab/git/diff_collection_spec.rb
index 6da07ce84a1..b202015464f 100644
--- a/spec/lib/gitlab/git/diff_collection_spec.rb
+++ b/spec/lib/gitlab/git/diff_collection_spec.rb
@@ -18,7 +18,7 @@ RSpec.describe Gitlab::Git::DiffCollection, :seed_helper do
return enum_for(:each) unless block_given?
loop do
- break if @count.zero?
+ break if @count == 0
# It is critical to decrement before yielding. We may never reach the lines after 'yield'.
@count -= 1
diff --git a/spec/lib/gitlab/git/diff_spec.rb b/spec/lib/gitlab/git/diff_spec.rb
index 91688c31f5e..117c519e98d 100644
--- a/spec/lib/gitlab/git/diff_spec.rb
+++ b/spec/lib/gitlab/git/diff_spec.rb
@@ -78,6 +78,7 @@ EOT
patch: raw_patch
)
end
+
let(:diff) { described_class.new(gitaly_diff) }
context 'with a small diff' do
@@ -134,6 +135,7 @@ EOT
to_id: '8e5177d718c561d36efde08bad36b43687ee6bf0'
)
end
+
let(:diff) { described_class.new(commit_delta) }
it 'initializes the diff' do
diff --git a/spec/lib/gitlab/git/patches/collection_spec.rb b/spec/lib/gitlab/git/patches/collection_spec.rb
index eb92f4663c8..67a502242ea 100644
--- a/spec/lib/gitlab/git/patches/collection_spec.rb
+++ b/spec/lib/gitlab/git/patches/collection_spec.rb
@@ -6,6 +6,7 @@ RSpec.describe Gitlab::Git::Patches::Collection do
let(:patch_content1) do
File.read(File.join(patches_folder, "0001-This-does-not-apply-to-the-feature-branch.patch"))
end
+
let(:patch_content2) do
File.read(File.join(patches_folder, "0001-A-commit-from-a-patch.patch"))
end
diff --git a/spec/lib/gitlab/git/patches/commit_patches_spec.rb b/spec/lib/gitlab/git/patches/commit_patches_spec.rb
index cd1e03a6de0..9ab0893eb55 100644
--- a/spec/lib/gitlab/git/patches/commit_patches_spec.rb
+++ b/spec/lib/gitlab/git/patches/commit_patches_spec.rb
@@ -10,6 +10,7 @@ RSpec.describe Gitlab::Git::Patches::CommitPatches do
Gitlab::Git::Patches::Collection.new([content_1, content_2])
end
+
let(:user) { build(:user) }
let(:branch_name) { 'branch-with-patches' }
let(:repository) { create(:project, :repository).repository }
diff --git a/spec/lib/gitlab/git/patches/patch_spec.rb b/spec/lib/gitlab/git/patches/patch_spec.rb
index 629f43d3636..6588b18d0ae 100644
--- a/spec/lib/gitlab/git/patches/patch_spec.rb
+++ b/spec/lib/gitlab/git/patches/patch_spec.rb
@@ -6,6 +6,7 @@ RSpec.describe Gitlab::Git::Patches::Patch do
let(:patch_content) do
File.read(File.join(patches_folder, "0001-This-does-not-apply-to-the-feature-branch.patch"))
end
+
let(:patch) { described_class.new(patch_content) }
describe '#size' do
diff --git a/spec/lib/gitlab/git/pre_receive_error_spec.rb b/spec/lib/gitlab/git/pre_receive_error_spec.rb
index bf4530c8945..2ad27361c80 100644
--- a/spec/lib/gitlab/git/pre_receive_error_spec.rb
+++ b/spec/lib/gitlab/git/pre_receive_error_spec.rb
@@ -6,15 +6,27 @@ RSpec.describe Gitlab::Git::PreReceiveError do
Gitlab::Git::PreReceiveError::SAFE_MESSAGE_PREFIXES.each do |prefix|
context "error messages prefixed with #{prefix}" do
it 'accepts only errors lines with the prefix' do
- ex = described_class.new("#{prefix} Hello,\nworld!")
+ raw_message = "#{prefix} Hello,\nworld!"
+ ex = described_class.new(raw_message)
expect(ex.message).to eq('Hello,')
+ expect(ex.raw_message).to eq(raw_message)
end
it 'makes its message HTML-friendly' do
- ex = described_class.new("#{prefix} Hello,\n#{prefix} world!\n")
+ raw_message = "#{prefix} Hello,\n#{prefix} world!\n"
+ ex = described_class.new(raw_message)
expect(ex.message).to eq('Hello,<br>world!')
+ expect(ex.raw_message).to eq(raw_message)
+ end
+
+ it 'sanitizes the user message' do
+ raw_message = 'Raw message'
+ ex = described_class.new(raw_message, "#{prefix} User message")
+
+ expect(ex.raw_message).to eq(raw_message)
+ expect(ex.message).to eq('User message')
end
end
end
diff --git a/spec/lib/gitlab/git/repository_spec.rb b/spec/lib/gitlab/git/repository_spec.rb
index e7f4573c95f..73eecd3401a 100644
--- a/spec/lib/gitlab/git/repository_spec.rb
+++ b/spec/lib/gitlab/git/repository_spec.rb
@@ -579,9 +579,11 @@ RSpec.describe Gitlab::Git::Repository, :seed_helper do
let(:commit_with_old_name) do
Gitlab::Git::Commit.find(repository, @commit_with_old_name_id)
end
+
let(:commit_with_new_name) do
Gitlab::Git::Commit.find(repository, @commit_with_new_name_id)
end
+
let(:rename_commit) do
Gitlab::Git::Commit.find(repository, @rename_commit_id)
end
@@ -2178,6 +2180,7 @@ RSpec.describe Gitlab::Git::Repository, :seed_helper do
let(:new_repository) do
Gitlab::Git::Repository.new('test_second_storage', TEST_REPO_PATH, '', 'group/project')
end
+
let(:new_repository_path) { File.join(TestEnv::SECOND_STORAGE_PATH, new_repository.relative_path) }
subject { new_repository.replicate(repository) }