diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-06-20 13:43:29 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-06-20 13:43:29 +0300 |
commit | 3b1af5cc7ed2666ff18b718ce5d30fa5a2756674 (patch) | |
tree | 3bc4a40e0ee51ec27eabf917c537033c0c5b14d4 /spec/lib/gitlab/github_import | |
parent | 9bba14be3f2c211bf79e15769cd9b77bc73a13bc (diff) |
Add latest changes from gitlab-org/gitlab@16-1-stable-eev16.1.0-rc42
Diffstat (limited to 'spec/lib/gitlab/github_import')
4 files changed, 20 insertions, 6 deletions
diff --git a/spec/lib/gitlab/github_import/attachments_downloader_spec.rb b/spec/lib/gitlab/github_import/attachments_downloader_spec.rb index dc9f939a19b..84d6713efdb 100644 --- a/spec/lib/gitlab/github_import/attachments_downloader_spec.rb +++ b/spec/lib/gitlab/github_import/attachments_downloader_spec.rb @@ -44,7 +44,7 @@ RSpec.describe Gitlab::GithubImport::AttachmentsDownloader do it 'raises expected exception' do expect { downloader.perform }.to raise_exception( - Gitlab::Utils::PathTraversalAttackError, + Gitlab::PathTraversal::PathTraversalAttackError, 'Invalid path' ) end @@ -56,7 +56,7 @@ RSpec.describe Gitlab::GithubImport::AttachmentsDownloader do it 'raises expected exception' do expect { downloader.perform }.to raise_exception( Gitlab::GithubImport::AttachmentsDownloader::DownloadError, - 'File size 26 MB exceeds limit of 25 MB' + 'File size 26 MiB exceeds limit of 25 MiB' ) end end diff --git a/spec/lib/gitlab/github_import/importer/diff_note_importer_spec.rb b/spec/lib/gitlab/github_import/importer/diff_note_importer_spec.rb index 73ba49bf4ed..0f35c7ee0dc 100644 --- a/spec/lib/gitlab/github_import/importer/diff_note_importer_spec.rb +++ b/spec/lib/gitlab/github_import/importer/diff_note_importer_spec.rb @@ -160,7 +160,8 @@ RSpec.describe Gitlab::GithubImport::Importer::DiffNoteImporter, :aggregate_fail new_path: file_path, old_path: file_path, position_type: 'text', - line_range: nil + line_range: nil, + ignore_whitespace_change: false }) expect(note.note) .to eq <<~NOTE diff --git a/spec/lib/gitlab/github_import/importer/repository_importer_spec.rb b/spec/lib/gitlab/github_import/importer/repository_importer_spec.rb index 0b8b1922d94..6b3d4485ea5 100644 --- a/spec/lib/gitlab/github_import/importer/repository_importer_spec.rb +++ b/spec/lib/gitlab/github_import/importer/repository_importer_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Gitlab::GithubImport::Importer::RepositoryImporter do +RSpec.describe Gitlab::GithubImport::Importer::RepositoryImporter, feature_category: :importers do let(:repository) { double(:repository) } let(:import_state) { double(:import_state) } let(:client) { double(:client) } @@ -23,6 +23,7 @@ RSpec.describe Gitlab::GithubImport::Importer::RepositoryImporter do let(:project) do double( :project, + id: 1, import_url: 'foo.git', import_source: 'foo/bar', repository_storage: 'foo', @@ -204,6 +205,8 @@ RSpec.describe Gitlab::GithubImport::Importer::RepositoryImporter do .to receive(:fetch_as_mirror) .with(project.import_url, refmap: Gitlab::GithubImport.refmap, forced: true) + expect(importer).to receive(:validate_repository_size!) + service = double expect(Repositories::HousekeepingService) .to receive(:new).with(project, :gc).and_return(service) diff --git a/spec/lib/gitlab/github_import/representation/diff_note_spec.rb b/spec/lib/gitlab/github_import/representation/diff_note_spec.rb index 3e76b4ae698..be202733a89 100644 --- a/spec/lib/gitlab/github_import/representation/diff_note_spec.rb +++ b/spec/lib/gitlab/github_import/representation/diff_note_spec.rb @@ -104,7 +104,8 @@ RSpec.describe Gitlab::GithubImport::Representation::DiffNote, :clean_gitlab_red old_line: nil, old_path: 'README.md', position_type: 'text', - start_sha: 'start' + start_sha: 'start', + ignore_whitespace_change: false ) end end @@ -122,7 +123,8 @@ RSpec.describe Gitlab::GithubImport::Representation::DiffNote, :clean_gitlab_red new_line: nil, old_path: 'README.md', position_type: 'text', - start_sha: 'start' + start_sha: 'start', + ignore_whitespace_change: false ) end end @@ -144,6 +146,14 @@ RSpec.describe Gitlab::GithubImport::Representation::DiffNote, :clean_gitlab_red expect(note.line_code).to eq('8ec9a00bfd09b3190ac6b22251dbb1aa95a0579d_2_2') end + + context 'when comment on file' do + it 'generates line code for first line' do + note = described_class.new(diff_hunk: '', file_path: 'README.md', subject_type: 'file') + + expect(note.line_code).to eq('8ec9a00bfd09b3190ac6b22251dbb1aa95a0579d_1_1') + end + end end describe '#note and #contains_suggestion?' do |