summaryrefslogtreecommitdiff
path: root/spec/lib/gitlab/popen_spec.rb
diff options
context:
space:
mode:
authorLin Jen-Shin <godfat@godfat.org>2018-01-23 20:12:51 +0800
committerLin Jen-Shin <godfat@godfat.org>2018-01-26 19:42:48 +0800
commit54ca8d0d6c4744be53c7044b9bbfa05acc358090 (patch)
treeb4258bc91245eca92b2ef5321f18e67ee524c61c /spec/lib/gitlab/popen_spec.rb
parenta0d57ee2b35f0e232aff930a94dfbcabe2860158 (diff)
downloadgitlab-ce-54ca8d0d6c4744be53c7044b9bbfa05acc358090.tar.gz
Fail static-analysis if there's output to stderr
TODO: fix offenders
Diffstat (limited to 'spec/lib/gitlab/popen_spec.rb')
-rw-r--r--spec/lib/gitlab/popen_spec.rb16
1 files changed, 14 insertions, 2 deletions
diff --git a/spec/lib/gitlab/popen_spec.rb b/spec/lib/gitlab/popen_spec.rb
index b145ca36f26..3401c86e540 100644
--- a/spec/lib/gitlab/popen_spec.rb
+++ b/spec/lib/gitlab/popen_spec.rb
@@ -1,11 +1,23 @@
require 'spec_helper'
-describe 'Gitlab::Popen' do
+describe Gitlab::Popen do
let(:path) { Rails.root.join('tmp').to_s }
before do
@klass = Class.new(Object)
- @klass.send(:include, Gitlab::Popen)
+ @klass.send(:include, described_class)
+ end
+
+ describe '.popen_with_detail' do
+ subject { @klass.new.popen_with_detail(cmd) }
+
+ let(:cmd) { %W[#{Gem.ruby} -e $stdout.puts(1);$stderr.puts(2);exit(3)] }
+
+ it { expect(subject.cmd).to eq(cmd) }
+ it { expect(subject.stdout).to eq("1\n") }
+ it { expect(subject.stderr).to eq("2\n") }
+ it { expect(subject.status).to eq(3) }
+ it { expect(subject.duration).to be_kind_of(Numeric) }
end
context 'zero status' do