diff options
author | Lin Jen-Shin <godfat@godfat.org> | 2017-04-17 17:10:41 +0800 |
---|---|---|
committer | Lin Jen-Shin <godfat@godfat.org> | 2017-04-17 17:10:41 +0800 |
commit | e7d3fe44f64d1efbbc0b9611cb3382feff4a2f00 (patch) | |
tree | b23806309abaa4238dd4d24ef9651cfaae292cc9 /spec/lib/gitlab/ci | |
parent | dac23fa233f98b521065fd3f21f6183f84b562d3 (diff) | |
download | gitlab-ce-e7d3fe44f64d1efbbc0b9611cb3382feff4a2f00.tar.gz |
Only set the encoding before passing to Ansi2html
Diffstat (limited to 'spec/lib/gitlab/ci')
-rw-r--r-- | spec/lib/gitlab/ci/trace/stream_spec.rb | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/spec/lib/gitlab/ci/trace/stream_spec.rb b/spec/lib/gitlab/ci/trace/stream_spec.rb index 6f5c9994f54..1602a4945ad 100644 --- a/spec/lib/gitlab/ci/trace/stream_spec.rb +++ b/spec/lib/gitlab/ci/trace/stream_spec.rb @@ -34,12 +34,12 @@ describe Gitlab::Ci::Trace::Stream do end context 'when the trace contains ANSI sequence and Unicode' do - let(:io) do - File.open(expand_fixture_path('trace/ansi-sequence-and-unicode')) + let(:stream) do + described_class.new do + File.open(expand_fixture_path('trace/ansi-sequence-and-unicode')) + end end - let(:stream) { described_class.new { io } } - it 'forwards to the next linefeed, case 1' do stream.limit(7) @@ -60,11 +60,11 @@ describe Gitlab::Ci::Trace::Stream do # See https://gitlab.com/gitlab-org/gitlab-ce/issues/30796 it 'reads in binary, output as Encoding.default_external' do - stream.limit(29) + stream.limit(52) - result = io.read # Ci::Ansi2html::Converter would read with each_line + result = stream.html - expect(result).to eq("\e[01;32m許功蓋\e[0m\n") + expect(result.lines.first).to eq("ヾ(´༎ຶД༎ຶ`)ノ<br><span class=\"term-fg-green\">許功蓋</span><br>") expect(result.encoding).to eq(Encoding.default_external) end end |