2018-03-17 18:26:18 +05:30
|
|
|
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
|
|
|
|
|
2019-02-13 22:33:31 +05:30
|
|
|
head :ok
|
2018-03-17 18:26:18 +05:30
|
|
|
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
|
2019-02-13 22:33:31 +05:30
|
|
|
get :show, params: { id: project.id }
|
2018-03-17 18:26:18 +05:30
|
|
|
|
|
|
|
expect(assigns(:storage_project)).to eq(project)
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'assigns the source of a forked project' do
|
|
|
|
forked_project = fork_project(project)
|
|
|
|
|
2019-02-13 22:33:31 +05:30
|
|
|
get :show, params: { id: forked_project.id }
|
2018-03-17 18:26:18 +05:30
|
|
|
|
|
|
|
expect(assigns(:storage_project)).to eq(project)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|