summaryrefslogtreecommitdiff
path: root/spec/features/projects/commits
diff options
context:
space:
mode:
authorEric Eastwood <contact@ericeastwood.com>2018-01-04 12:54:34 -0600
committerEric Eastwood <contact@ericeastwood.com>2018-01-09 16:51:53 -0600
commit1faaf6ffbc7ccf8dd12245a7003de9d91088d11c (patch)
tree554b792bfedd98040a5023f8ccf2b65ae02e301a /spec/features/projects/commits
parent65b04860c24949f8c327db0be9fc967dfe8225b5 (diff)
downloadgitlab-ce-1faaf6ffbc7ccf8dd12245a7003de9d91088d11c.tar.gz
Fix 500 when visiting a commit where blobs do not exist (nil blobs)41491-fix-nil-blob-name-error
Fix https://gitlab.com/gitlab-org/gitlab-ce/issues/41491
Diffstat (limited to 'spec/features/projects/commits')
-rw-r--r--spec/features/projects/commits/user_browses_commits_spec.rb15
1 files changed, 14 insertions, 1 deletions
diff --git a/spec/features/projects/commits/user_browses_commits_spec.rb b/spec/features/projects/commits/user_browses_commits_spec.rb
index 41f3c15a94c..b650c1f4197 100644
--- a/spec/features/projects/commits/user_browses_commits_spec.rb
+++ b/spec/features/projects/commits/user_browses_commits_spec.rb
@@ -1,6 +1,6 @@
require 'spec_helper'
-describe 'User broweses commits' do
+describe 'User browses commits' do
let(:user) { create(:user) }
let(:project) { create(:project, :repository, namespace: user.namespace) }
@@ -31,6 +31,19 @@ describe 'User broweses commits' do
check_author_link(RepoHelpers.sample_commit.author_email, user)
end
end
+
+ context 'when the blob does not exist' do
+ let(:commit) { create(:commit, project: project) }
+
+ it 'shows a blank label' do
+ allow_any_instance_of(Gitlab::Diff::File).to receive(:blob).and_return(nil)
+ allow_any_instance_of(Gitlab::Diff::File).to receive(:raw_binary?).and_return(true)
+
+ visit(project_commit_path(project, commit))
+
+ expect(find('.diff-file-changes', visible: false)).to have_content('No file name available')
+ end
+ end
end
private