Don't blow up in tree view on empty repo
This commit is contained in:
parent
2556d6d347
commit
87035c2945
2 changed files with 21 additions and 1 deletions
|
@ -5,7 +5,7 @@ class ProjectsController < Projects::ApplicationController
|
|||
before_action :project, except: [:new, :create]
|
||||
before_action :repository, except: [:new, :create]
|
||||
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
|
||||
before_action :authorize_admin_project!, only: [:edit, :update, :housekeeping, :download_export, :export, :remove_export, :generate_new_export]
|
||||
|
|
|
@ -43,6 +43,26 @@ describe ProjectsController do
|
|||
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
|
||||
render_views
|
||||
|
||||
|
|
Loading…
Reference in a new issue