diff options
Diffstat (limited to 'spec/helpers/tree_helper_spec.rb')
-rw-r--r-- | spec/helpers/tree_helper_spec.rb | 88 |
1 files changed, 0 insertions, 88 deletions
diff --git a/spec/helpers/tree_helper_spec.rb b/spec/helpers/tree_helper_spec.rb index 6cb9894e306..bc25a2fcdfc 100644 --- a/spec/helpers/tree_helper_spec.rb +++ b/spec/helpers/tree_helper_spec.rb @@ -19,94 +19,6 @@ RSpec.describe TreeHelper do ) end - describe '.render_tree' do - before do - @id = sha - @path = "" - @project = project - @lfs_blob_ids = [] - end - - it 'displays all entries without a warning' do - tree = repository.tree(sha, 'files') - - html = render_tree(tree) - - expect(html).not_to have_selector('.tree-truncated-warning') - end - - it 'truncates entries and adds a warning' do - stub_const('TreeHelper::FILE_LIMIT', 1) - tree = repository.tree(sha, 'files') - - html = render_tree(tree) - - expect(html).to have_selector('.tree-truncated-warning', count: 1) - expect(html).to have_selector('.tree-item-file-name', count: 1) - end - end - - describe '.fast_project_blob_path' do - it 'generates the same path as project_blob_path' do - blob_path = repository.tree(sha, 'with space').entries.first.path - fast_path = fast_project_blob_path(project, blob_path) - std_path = project_blob_path(project, blob_path) - - expect(fast_path).to eq(std_path) - end - - it 'generates the same path with encoded file names' do - tree = repository.tree(sha, 'encoding') - blob_path = tree.entries.find { |entry| entry.path == 'encoding/ใในใ.txt' }.path - fast_path = fast_project_blob_path(project, blob_path) - std_path = project_blob_path(project, blob_path) - - expect(fast_path).to eq(std_path) - end - - it 'respects a configured relative URL' do - allow(Gitlab.config.gitlab).to receive(:relative_url_root).and_return('/gitlab/root') - blob_path = repository.tree(sha, '').entries.first.path - fast_path = fast_project_blob_path(project, blob_path) - - expect(fast_path).to start_with('/gitlab/root') - end - - it 'encodes files starting with #' do - filename = '#test-file' - create_file(filename) - - fast_path = fast_project_blob_path(project, filename) - - expect(fast_path).to end_with('%23test-file') - end - end - - describe '.fast_project_tree_path' do - let(:tree_path) { repository.tree(sha, 'with space').path } - let(:fast_path) { fast_project_tree_path(project, tree_path) } - let(:std_path) { project_tree_path(project, tree_path) } - - it 'generates the same path as project_tree_path' do - expect(fast_path).to eq(std_path) - end - - it 'respects a configured relative URL' do - allow(Gitlab.config.gitlab).to receive(:relative_url_root).and_return('/gitlab/root') - - expect(fast_path).to start_with('/gitlab/root') - end - - it 'encodes files starting with #' do - filename = '#test-file' - create_file(filename) - - fast_path = fast_project_tree_path(project, filename) - - expect(fast_path).to end_with('%23test-file') - end - end - describe 'flatten_tree' do let(:tree) { repository.tree(sha, 'files') } let(:root_path) { 'files' } |