diff options
author | Lin Jen-Shin <godfat@godfat.org> | 2017-01-26 18:23:01 +0800 |
---|---|---|
committer | Lin Jen-Shin <godfat@godfat.org> | 2017-01-26 18:23:01 +0800 |
commit | e9d8fc94e6e13f8b2d145f549d4a939ca25a3d93 (patch) | |
tree | d541830b1b790fdbc0346dfc11145ea7f47b6785 /spec | |
parent | 37b4503125c797fbcb7b00f1e73d574dfdfa5816 (diff) | |
download | gitlab-ce-e9d8fc94e6e13f8b2d145f549d4a939ca25a3d93.tar.gz |
Make sure TraceReader uses Encoding.default_external
Encoding.default_external was chosen over
Encoding.default_internal because File.read is
returning Encoding.default_external, therefore
we should align with it. Alternatively, we could
force both of them to be Encoding.default_internal.
However, ideally this should be determined by different
projects. For example, some projects might want to use
an encoding different to what GitLab is using.
This might not happen soon though.
Closes #27052
Diffstat (limited to 'spec')
-rw-r--r-- | spec/lib/gitlab/ci/trace_reader_spec.rb | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/spec/lib/gitlab/ci/trace_reader_spec.rb b/spec/lib/gitlab/ci/trace_reader_spec.rb index f06d78694d6..ff5551bf703 100644 --- a/spec/lib/gitlab/ci/trace_reader_spec.rb +++ b/spec/lib/gitlab/ci/trace_reader_spec.rb @@ -11,13 +11,25 @@ describe Gitlab::Ci::TraceReader do last_lines = random_lines expected = lines.last(last_lines).join + result = subject.read(last_lines: last_lines) - expect(subject.read(last_lines: last_lines)).to eq(expected) + expect(result).to eq(expected) + expect(result.encoding).to eq(Encoding.default_external) end end it 'returns everything if trying to get too many lines' do - expect(build_subject.read(last_lines: lines.size * 2)).to eq(lines.join) + result = build_subject.read(last_lines: lines.size * 2) + + expect(result).to eq(lines.join) + expect(result.encoding).to eq(Encoding.default_external) + end + + it 'returns all contents if last_lines is not specified' do + result = build_subject.read + + expect(result).to eq(lines.join) + expect(result.encoding).to eq(Encoding.default_external) end it 'raises an error if not passing an integer for last_lines' do |