Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/spec/lib
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-02-27 00:53:46 +0400
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-02-27 00:53:46 +0400
commit2c5e4955c020eb8d5a28a48d6adc375c327523ac (patch)
tree07c690adf89069f4b6afaef9e4266a2ce9c0597b /spec/lib
parent9c252a60c195cb348c9776f40ca2c6b1f33723f9 (diff)
specs for Gitlab::Popen
Diffstat (limited to 'spec/lib')
-rw-r--r--spec/lib/popen_spec.rb29
1 files changed, 29 insertions, 0 deletions
diff --git a/spec/lib/popen_spec.rb b/spec/lib/popen_spec.rb
new file mode 100644
index 00000000000..f5b3f94750c
--- /dev/null
+++ b/spec/lib/popen_spec.rb
@@ -0,0 +1,29 @@
+require 'spec_helper'
+
+describe 'Gitlab::Popen', no_db: true do
+ let (:path) { Rails.root.join('tmp').to_s }
+
+ before do
+ @klass = Class.new(Object)
+ @klass.send(:include, Gitlab::Popen)
+ end
+
+ context 'zero status' do
+ before do
+ @output, @status = @klass.new.popen('ls', path)
+ end
+
+ it { @status.should be_zero }
+ it { @output.should include('pids') }
+ end
+
+ context 'non-zero status' do
+ before do
+ @output, @status = @klass.new.popen('cat NOTHING', path)
+ end
+
+ it { @status.should == 1 }
+ it { @output.should include('No such file or directory') }
+ end
+end
+