Implement `has_executable' condition keyword

This commit is contained in:
Thibault Jouan
2014-03-05 07:19:15 +00:00
parent aa3694b58c
commit eeab386216
6 changed files with 86 additions and 5 deletions

View File

@@ -7,7 +7,13 @@ module Producer::Core
let(:env) { double 'env' }
subject(:dsl) { DSL.new(env, &block) }
%w[file_contains has_dir has_env has_file].each do |test|
%w[
file_contains
has_dir
has_env
has_executable
has_file
].each do |test|
it "has `#{test}' test defined" do
expect(dsl).to respond_to test.to_sym
end

View File

@@ -0,0 +1,29 @@
require 'spec_helper'
module Producer::Core
module Tests
describe HasExecutable, :env do
subject(:has_env) { HasExecutable.new(env, executable) }
it_behaves_like 'test'
describe '#verify' do
context 'executable exists' do
let(:executable) { 'true' }
it 'returns true' do
expect(has_env.verify).to be true
end
end
context 'executable does not exist' do
let(:executable) { 'some_non_existent_executable' }
it 'returns false' do
expect(has_env.verify).to be false
end
end
end
end
end
end