gitlab-org--gitlab-foss/spec/lib/popen_spec.rb

30 lines
612 B
Ruby
Raw Normal View History

2013-02-26 15:53:46 -05:00
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 }
2013-02-27 01:24:12 -05:00
it { @output.should include('cache') }
2013-02-26 15:53:46 -05:00
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