debian-mirror-gitlab/spec/lib/gitlab/diff/file_collection/commit_spec.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

87 lines
2.2 KiB
Ruby
Raw Normal View History

2018-12-05 23:21:45 +05:30
# frozen_string_literal: true
require 'spec_helper'
2020-07-28 23:09:34 +05:30
RSpec.describe Gitlab::Diff::FileCollection::Commit do
2018-12-05 23:21:45 +05:30
let(:project) { create(:project, :repository) }
2021-02-22 17:27:13 +05:30
let(:diffable) { project.commit }
2018-12-05 23:21:45 +05:30
2021-02-22 17:27:13 +05:30
let(:collection_default_args) do
{ diff_options: {} }
end
2020-10-24 23:57:45 +05:30
2021-02-22 17:27:13 +05:30
it_behaves_like 'diff statistics' do
2018-12-05 23:21:45 +05:30
let(:stub_path) { 'bar/branch-test.txt' }
end
2019-02-15 15:39:39 +05:30
2021-02-22 17:27:13 +05:30
it_behaves_like 'unfoldable diff'
it_behaves_like 'sortable diff files' do
let(:diffable) { project.commit('913c66a') }
let(:unsorted_diff_files_paths) do
[
'.DS_Store',
'CHANGELOG',
'MAINTENANCE.md',
'PROCESS.md',
'VERSION',
'encoding/feature-1.txt',
'encoding/feature-2.txt',
'encoding/hotfix-1.txt',
'encoding/hotfix-2.txt',
'encoding/russian.rb',
'encoding/test.txt',
'encoding/テスト.txt',
'encoding/テスト.xls',
'files/.DS_Store',
'files/html/500.html',
'files/images/logo-black.png',
'files/images/logo-white.png',
'files/js/application.js',
'files/js/commit.js.coffee',
'files/markdown/ruby-style-guide.md',
'files/ruby/popen.rb',
'files/ruby/regex.rb',
'files/ruby/version_info.rb'
]
end
let(:sorted_diff_files_paths) do
[
'encoding/feature-1.txt',
'encoding/feature-2.txt',
'encoding/hotfix-1.txt',
'encoding/hotfix-2.txt',
'encoding/russian.rb',
'encoding/test.txt',
'encoding/テスト.txt',
'encoding/テスト.xls',
'files/html/500.html',
'files/images/logo-black.png',
'files/images/logo-white.png',
'files/js/application.js',
'files/js/commit.js.coffee',
'files/markdown/ruby-style-guide.md',
'files/ruby/popen.rb',
'files/ruby/regex.rb',
'files/ruby/version_info.rb',
'files/.DS_Store',
'.DS_Store',
'CHANGELOG',
'MAINTENANCE.md',
'PROCESS.md',
'VERSION'
]
end
2019-02-15 15:39:39 +05:30
end
2021-09-30 23:02:18 +05:30
describe '#cache_key' do
subject(:cache_key) { described_class.new(diffable, diff_options: nil).cache_key }
it 'returns with the commit id' do
expect(cache_key).to eq ['commit', diffable.id]
end
end
2018-12-05 23:21:45 +05:30
end