Commit 2c5e4955 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

specs for Gitlab::Popen

parent 9c252a60
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
...@@ -9,10 +9,14 @@ RSpec.configure do |config| ...@@ -9,10 +9,14 @@ RSpec.configure do |config|
DatabaseCleaner.strategy = :transaction DatabaseCleaner.strategy = :transaction
end end
unless example.metadata[:no_db]
DatabaseCleaner.start DatabaseCleaner.start
end end
end
config.after do config.after do
unless example.metadata[:no_db]
DatabaseCleaner.clean DatabaseCleaner.clean
end end
end
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment