Commit 87035c29 authored by Sean McGivern's avatar Sean McGivern

Don't blow up in tree view on empty repo

parent 2556d6d3
...@@ -5,7 +5,7 @@ class ProjectsController < Projects::ApplicationController ...@@ -5,7 +5,7 @@ class ProjectsController < Projects::ApplicationController
before_action :project, except: [:new, :create] before_action :project, except: [:new, :create]
before_action :repository, except: [:new, :create] before_action :repository, except: [:new, :create]
before_action :assign_ref_vars, only: [:show], if: :repo_exists? before_action :assign_ref_vars, only: [:show], if: :repo_exists?
before_action :tree, only: [:show], if: :project_view_files? before_action :tree, only: [:show], if: [:repo_exists?, :project_view_files?]
# Authorize # Authorize
before_action :authorize_admin_project!, only: [:edit, :update, :housekeeping, :download_export, :export, :remove_export, :generate_new_export] before_action :authorize_admin_project!, only: [:edit, :update, :housekeeping, :download_export, :export, :remove_export, :generate_new_export]
......
...@@ -43,6 +43,26 @@ describe ProjectsController do ...@@ -43,6 +43,26 @@ describe ProjectsController do
end end
end end
context "project with empty repo" do
let(:empty_project) { create(:project_empty_repo, :public) }
before { sign_in(user) }
User.project_views.keys.each do |project_view|
context "with #{project_view} view set" do
before do
user.update_attributes(project_view: project_view)
get :show, namespace_id: empty_project.namespace.path, id: empty_project.path
end
it "renders the empty project view" do
expect(response).to render_template('empty')
end
end
end
end
context "rendering default project view" do context "rendering default project view" do
render_views render_views
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment