Implement `` condition keyword (shell cmd status)

This commit is contained in:
Thibault Jouan
2014-03-08 19:43:41 +00:00
parent a2ca62e7f8
commit 7c6ac4c9d8
6 changed files with 85 additions and 0 deletions

View File

@@ -8,6 +8,7 @@ module Producer::Core
subject(:dsl) { DSL.new(env, &block) }
%w[
`
file_contains
has_dir
has_env

View File

@@ -0,0 +1,34 @@
require 'spec_helper'
module Producer::Core
module Tests
describe ShellCommandStatus, :env do
let(:command) { 'true' }
subject(:test) { described_class.new(env, command) }
it_behaves_like 'test'
describe '#verify' do
context 'command return status is 0' do
it 'returns true' do
expect(test.verify).to be true
end
end
context 'command return status is not 0' do
let(:command) { 'false' }
it 'returns false' do
expect(test.verify).to be false
end
end
end
describe '#command' do
it 'returns the first argument' do
expect(test.command).to eq command
end
end
end
end
end