提交 5cdbec20 编写于 作者: S Shinya Maeda

Add test

上级 c0997eca
......@@ -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) }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册