summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2017-10-19 12:18:42 +0000
committerDouwe Maan <douwe@gitlab.com>2017-10-19 12:18:42 +0000
commit228bbb3af03f386b26cedd336ad5d95b0da91508 (patch)
tree7a3b78bd7558b34c409a7d0dec74ac2fed51331c /spec
parentac782f562dbd9adba42f5ee1d2c3c997f75a95b9 (diff)
parentada114065f332bb7d4add3156dd177eaf6662aaa (diff)
downloadgitlab-ce-228bbb3af03f386b26cedd336ad5d95b0da91508.tar.gz
Merge branch 'not-found-in-commits' into 'master'
Renders 404 in commits controller if no commits are found Closes #37620 See merge request gitlab-org/gitlab-ce!14610
Diffstat (limited to 'spec')
-rw-r--r--spec/controllers/projects/commits_controller_spec.rb31
1 files changed, 29 insertions, 2 deletions
diff --git a/spec/controllers/projects/commits_controller_spec.rb b/spec/controllers/projects/commits_controller_spec.rb
index e26731fb691..c459d732507 100644
--- a/spec/controllers/projects/commits_controller_spec.rb
+++ b/spec/controllers/projects/commits_controller_spec.rb
@@ -10,9 +10,36 @@ describe Projects::CommitsController do
end
describe "GET show" do
- context "when the ref name ends in .atom" do
- render_views
+ render_views
+
+ context 'with file path' do
+ before do
+ get(:show,
+ namespace_id: project.namespace,
+ project_id: project,
+ id: id)
+ end
+
+ context "valid branch, valid file" do
+ let(:id) { 'master/README.md' }
+
+ it { is_expected.to respond_with(:success) }
+ end
+
+ context "valid branch, invalid file" do
+ let(:id) { 'master/invalid-path.rb' }
+ it { is_expected.to respond_with(:not_found) }
+ end
+
+ context "invalid branch, valid file" do
+ let(:id) { 'invalid-branch/README.md' }
+
+ it { is_expected.to respond_with(:not_found) }
+ end
+ end
+
+ context "when the ref name ends in .atom" do
context "when the ref does not exist with the suffix" do
it "renders as atom" do
get(:show,