summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/controllers/projects/refs_controller.rb2
-rw-r--r--spec/controllers/projects/refs_controller_spec.rb8
-rw-r--r--spec/features/projects/tree/create_directory_spec.rb5
3 files changed, 4 insertions, 11 deletions
diff --git a/app/controllers/projects/refs_controller.rb b/app/controllers/projects/refs_controller.rb
index ff79f88afc3..82f7ccb6afa 100644
--- a/app/controllers/projects/refs_controller.rb
+++ b/app/controllers/projects/refs_controller.rb
@@ -60,7 +60,7 @@ class Projects::RefsController < Projects::ApplicationController
file_name: content.name,
commit: last_commit,
type: content.type,
- commit_path: project_commit_path(@project, last_commit)
+ commit_path: (project_commit_path(@project, last_commit) unless last_commit.nil?)
}
end
end
diff --git a/spec/controllers/projects/refs_controller_spec.rb b/spec/controllers/projects/refs_controller_spec.rb
index 4c1315b26c1..748ae040928 100644
--- a/spec/controllers/projects/refs_controller_spec.rb
+++ b/spec/controllers/projects/refs_controller_spec.rb
@@ -19,13 +19,13 @@ describe Projects::RefsController do
format: format
end
- def xhr_get(format = :html, path = 'foo/bar/baz.html')
+ def xhr_get(format = :html)
xhr :get,
:logs_tree,
namespace_id: project.namespace.to_param,
project_id: project,
id: 'master',
- path: path,
+ path: 'foo/bar/baz.html',
format: format
end
@@ -47,12 +47,10 @@ describe Projects::RefsController do
end
it 'renders JSON' do
- xhr_get(:json, '/')
+ xhr_get(:json)
expect(response).to be_success
expect(json_response).to be_kind_of(Array)
- expect(json_response[0]['type']).to eq('tree')
- expect(json_response[0]['file_name']).to eq('bar')
end
end
end
diff --git a/spec/features/projects/tree/create_directory_spec.rb b/spec/features/projects/tree/create_directory_spec.rb
index 8ee7b9cf015..1686e7fa342 100644
--- a/spec/features/projects/tree/create_directory_spec.rb
+++ b/spec/features/projects/tree/create_directory_spec.rb
@@ -31,10 +31,5 @@ feature 'Multi-file editor new directory', :js do
click_button('Commit 1 file')
expect(page).to have_selector('td', text: 'commit message')
-
- click_link('foldername')
-
- expect(page).to have_selector('td', text: 'commit message', count: 2)
- expect(page).to have_selector('td', text: '.gitkeep')
end
end