debian-mirror-gitlab/spec/controllers/concerns/lfs_request_spec.rb

53 lines
1,010 B
Ruby
Raw Normal View History

2019-07-31 22:56:46 +05:30
# frozen_string_literal: true
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-15 15:39:39 +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-15 15:39:39 +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-15 15:39:39 +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