2019-10-12 21:52:04 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-10-15 14:42:47 +05:30
|
|
|
require 'spec_helper'
|
|
|
|
|
2020-06-23 00:09:42 +05:30
|
|
|
RSpec.describe 'Projects > Files > User browses LFS files' do
|
2018-10-15 14:42:47 +05:30
|
|
|
let(:project) { create(:project, :repository) }
|
|
|
|
let(:user) { project.owner }
|
|
|
|
|
|
|
|
before do
|
|
|
|
sign_in(user)
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'when LFS is disabled', :js do
|
|
|
|
before do
|
|
|
|
allow_any_instance_of(Project).to receive(:lfs_enabled?).and_return(false)
|
|
|
|
visit project_tree_path(project, 'lfs')
|
2019-02-15 15:39:39 +05:30
|
|
|
wait_for_requests
|
2018-10-15 14:42:47 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
it 'is possible to see raw content of LFS pointer' do
|
|
|
|
click_link 'files'
|
2020-03-13 15:44:24 +05:30
|
|
|
|
|
|
|
page.within('.repo-breadcrumb') do
|
|
|
|
expect(page).to have_link('files')
|
|
|
|
end
|
|
|
|
|
2018-10-15 14:42:47 +05:30
|
|
|
click_link 'lfs'
|
2020-03-13 15:44:24 +05:30
|
|
|
|
|
|
|
page.within('.repo-breadcrumb') do
|
|
|
|
expect(page).to have_link('lfs')
|
|
|
|
end
|
|
|
|
|
2018-10-15 14:42:47 +05:30
|
|
|
click_link 'lfs_object.iso'
|
|
|
|
|
|
|
|
expect(page).to have_content 'version https://git-lfs.github.com/spec/v1'
|
|
|
|
expect(page).to have_content 'oid sha256:91eff75a492a3ed0dfcb544d7f31326bc4014c8551849c192fd1e48d4dd2c897'
|
|
|
|
expect(page).to have_content 'size 1575078'
|
|
|
|
expect(page).not_to have_content 'Download (1.5 MB)'
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2019-02-15 15:39:39 +05:30
|
|
|
context 'when LFS is enabled', :js do
|
2018-10-15 14:42:47 +05:30
|
|
|
before do
|
|
|
|
allow_any_instance_of(Project).to receive(:lfs_enabled?).and_return(true)
|
|
|
|
visit project_tree_path(project, 'lfs')
|
2019-02-15 15:39:39 +05:30
|
|
|
wait_for_requests
|
2018-10-15 14:42:47 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
it 'shows an LFS object' do
|
|
|
|
click_link('files')
|
2020-03-13 15:44:24 +05:30
|
|
|
|
|
|
|
page.within('.repo-breadcrumb') do
|
|
|
|
expect(page).to have_link('files')
|
|
|
|
end
|
|
|
|
|
2018-10-15 14:42:47 +05:30
|
|
|
click_link('lfs')
|
|
|
|
click_link('lfs_object.iso')
|
|
|
|
|
|
|
|
expect(page).to have_content('Download (1.5 MB)')
|
|
|
|
expect(page).not_to have_content('version https://git-lfs.github.com/spec/v1')
|
|
|
|
expect(page).not_to have_content('oid sha256:91eff75a492a3ed0dfcb544d7f31326bc4014c8551849c192fd1e48d4dd2c897')
|
|
|
|
expect(page).not_to have_content('size 1575078')
|
|
|
|
|
|
|
|
page.within('.content') do
|
|
|
|
expect(page).to have_content('Delete')
|
|
|
|
expect(page).to have_content('History')
|
|
|
|
expect(page).to have_content('Permalink')
|
|
|
|
expect(page).to have_content('Replace')
|
2021-01-03 14:25:43 +05:30
|
|
|
expect(page).to have_link('Download')
|
|
|
|
|
2018-10-15 14:42:47 +05:30
|
|
|
expect(page).not_to have_content('Annotate')
|
|
|
|
expect(page).not_to have_content('Blame')
|
2021-01-03 14:25:43 +05:30
|
|
|
|
|
|
|
expect(page).not_to have_selector(:link_or_button, text: /^Edit$/)
|
|
|
|
expect(page).to have_selector(:link_or_button, 'Edit in Web IDE')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'when feature flag :consolidated_edit_button is off' do
|
|
|
|
before do
|
|
|
|
stub_feature_flags(consolidated_edit_button: false)
|
|
|
|
|
|
|
|
click_link('files')
|
|
|
|
click_link('lfs')
|
|
|
|
click_link('lfs_object.iso')
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'does not show single file edit link' do
|
|
|
|
page.within('.content') do
|
|
|
|
expect(page).to have_selector(:link_or_button, 'Web IDE')
|
|
|
|
expect(page).not_to have_selector(:link_or_button, 'Edit')
|
|
|
|
end
|
2018-10-15 14:42:47 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|