2017-11-03 09:59:47 -04:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe LfsRequest do
|
|
|
|
include ProjectForksHelper
|
|
|
|
|
|
|
|
controller(Projects::GitHttpClientController) do
|
|
|
|
# `described_class` is not available in this context
|
|
|
|
include LfsRequest # rubocop:disable RSpec/DescribedClass
|
|
|
|
|
|
|
|
def show
|
|
|
|
storage_project
|
|
|
|
|
2018-11-22 12:47:29 -05:00
|
|
|
head :ok
|
2017-11-03 09:59:47 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def project
|
|
|
|
@project ||= Project.find(params[:id])
|
|
|
|
end
|
|
|
|
|
|
|
|
def download_request?
|
|
|
|
true
|
|
|
|
end
|
|
|
|
|
|
|
|
def ci?
|
|
|
|
false
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
let(:project) { create(:project, :public) }
|
|
|
|
|
|
|
|
before do
|
|
|
|
stub_lfs_setting(enabled: true)
|
|
|
|
end
|
|
|
|
|
|
|
|
describe '#storage_project' do
|
|
|
|
it 'assigns the project as storage project' do
|
2018-12-17 17:52:17 -05:00
|
|
|
get :show, params: { id: project.id }
|
2017-11-03 09:59:47 -04:00
|
|
|
|
|
|
|
expect(assigns(:storage_project)).to eq(project)
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'assigns the source of a forked project' do
|
|
|
|
forked_project = fork_project(project)
|
|
|
|
|
2018-12-17 17:52:17 -05:00
|
|
|
get :show, params: { id: forked_project.id }
|
2017-11-03 09:59:47 -04:00
|
|
|
|
|
|
|
expect(assigns(:storage_project)).to eq(project)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|