Commit 9c990bbe authored by Shinya Maeda's avatar Shinya Maeda

Add test

parent d6b18d39
...@@ -8,7 +8,7 @@ module Gitlab ...@@ -8,7 +8,7 @@ module Gitlab
attr_reader :stream 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 delegate :valid?, to: :stream, as: :present?, allow_nil: true
...@@ -22,7 +22,11 @@ module Gitlab ...@@ -22,7 +22,11 @@ module Gitlab
end end
def file? 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 end
def limit(last_bytes = LIMIT_SIZE) def limit(last_bytes = LIMIT_SIZE)
......
...@@ -513,6 +513,22 @@ describe Projects::JobsController do ...@@ -513,6 +513,22 @@ describe Projects::JobsController do
end end
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 context 'when job does not have a trace file' do
let(:job) { create(:ci_build, pipeline: pipeline) } let(:job) { create(:ci_build, pipeline: pipeline) }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment