Skip to content
Snippets Groups Projects
Commit ee3b0c3a authored by Lin Jen-Shin's avatar Lin Jen-Shin
Browse files

Make sure we're giving Encoding.default_external

parent eeaeb275
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -14,6 +14,7 @@ module Gitlab
 
def initialize
@stream = yield
@stream.binmode
end
 
def valid?
Loading
Loading
@@ -51,7 +52,7 @@ module Gitlab
read_last_lines(last_lines)
else
stream.read
end
end.force_encoding(Encoding.default_external)
end
 
def html_with_state(state = nil)
Loading
Loading
@@ -113,7 +114,6 @@ module Gitlab
end
 
chunks.join.lines.last(last_lines).join
.force_encoding(Encoding.default_external)
end
end
end
Loading
Loading
Loading
Loading
@@ -2,7 +2,7 @@ require 'spec_helper'
 
describe Gitlab::Ci::Trace::Stream do
describe 'delegates' do
subject { described_class.new { nil } }
subject { described_class.new { StringIO.new } }
 
it { is_expected.to delegate_method(:close).to(:stream) }
it { is_expected.to delegate_method(:tell).to(:stream) }
Loading
Loading
@@ -43,13 +43,19 @@ describe Gitlab::Ci::Trace::Stream do
it 'forwards to the next linefeed, case 1' do
stream.limit(7)
 
expect(stream.raw).to eq('')
result = stream.raw
expect(result).to eq('')
expect(result.encoding).to eq(Encoding.default_external)
end
 
it 'forwards to the next linefeed, case 2' do
stream.limit(29)
 
expect(stream.raw).to eq("\e[01;32m許功蓋\e[0m\n")
result = stream.raw
expect(result).to eq("\e[01;32m許功蓋\e[0m\n")
expect(result.encoding).to eq(Encoding.default_external)
end
end
end
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment