diff options
Diffstat (limited to 'spec/lib/gitlab/diff/file_collection/commit_spec.rb')
-rw-r--r-- | spec/lib/gitlab/diff/file_collection/commit_spec.rb | 72 |
1 files changed, 65 insertions, 7 deletions
diff --git a/spec/lib/gitlab/diff/file_collection/commit_spec.rb b/spec/lib/gitlab/diff/file_collection/commit_spec.rb index 7773604a638..3d995b36b6f 100644 --- a/spec/lib/gitlab/diff/file_collection/commit_spec.rb +++ b/spec/lib/gitlab/diff/file_collection/commit_spec.rb @@ -4,17 +4,75 @@ require 'spec_helper' RSpec.describe Gitlab::Diff::FileCollection::Commit do let(:project) { create(:project, :repository) } + let(:diffable) { project.commit } - it_behaves_like 'diff statistics' do - let(:collection_default_args) do - { diff_options: {} } - end + let(:collection_default_args) do + { diff_options: {} } + end - let(:diffable) { project.commit } + it_behaves_like 'diff statistics' do let(:stub_path) { 'bar/branch-test.txt' } end - it_behaves_like 'unfoldable diff' do - let(:diffable) { project.commit } + 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 end end |