Add test
This commit is contained in:
parent
d6b18d3946
commit
9c990bbe7a
2 changed files with 22 additions and 2 deletions
|
@ -8,7 +8,7 @@ module Gitlab
|
|||
|
||||
attr_reader :stream
|
||||
|
||||
delegate :close, :tell, :seek, :size, :path, :url, :truncate, to: :stream, allow_nil: true
|
||||
delegate :close, :tell, :seek, :size, :url, :truncate, to: :stream, allow_nil: true
|
||||
|
||||
delegate :valid?, to: :stream, as: :present?, allow_nil: true
|
||||
|
||||
|
@ -22,7 +22,11 @@ module Gitlab
|
|||
end
|
||||
|
||||
def file?
|
||||
self.path.present? if respond_to?(:path)
|
||||
self.path.present?
|
||||
end
|
||||
|
||||
def path
|
||||
self.stream.path if self.stream.respond_to?(:path)
|
||||
end
|
||||
|
||||
def limit(last_bytes = LIMIT_SIZE)
|
||||
|
|
|
@ -513,6 +513,22 @@ describe Projects::JobsController do
|
|||
end
|
||||
end
|
||||
|
||||
context 'when job has a trace in database' do
|
||||
let(:job) { create(:ci_build, pipeline: pipeline) }
|
||||
|
||||
before do
|
||||
job.update_column(:trace, 'Sample trace')
|
||||
end
|
||||
|
||||
it 'send a trace file' do
|
||||
response = subject
|
||||
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
expect(response.content_type).to eq 'text/plain; charset=utf-8'
|
||||
expect(response.body).to eq 'Sample trace'
|
||||
end
|
||||
end
|
||||
|
||||
context 'when job does not have a trace file' do
|
||||
let(:job) { create(:ci_build, pipeline: pipeline) }
|
||||
|
||||
|
|
Loading…
Reference in a new issue