Sha256: 871307a46e536484e7959b9b75b2dc1ed7b04d2dd601cf7fce92fe837abe0235

Contents?: true

Size: 994 Bytes

Versions: 8

Compression:

Stored size: 994 Bytes

Contents

require 'spec_helper'
require production_code

describe RakeNBake::DependencyChecker do
  let(:silent) { true }
  let(:list){ ['present', 'missing'] }

  subject{RakeNBake::DependencyChecker.new list}

  before do
    double_cmd('which present', exit: 0)
    double_cmd('which missing', exit: 1)
  end

  describe '#check' do
    it 'returns a hash of dependencies => presence' do
      result = subject.check(silent)
      expect(result).to eq({'present' => true, 'missing' => false})
    end

    it 'prints a dot for dependencies which are present' do
      expect{subject.check}.to output(/\./).to_stdout
    end

    it 'prints a F for missing dependencies' do
      expect{subject.check}.to output(/F/).to_stdout
    end

    it 'can be run without printing anything out' do
      expect{subject.check(silent)}.to_not output.to_stdout
    end
  end

  describe '#missing' do
    it 'returns only missing dependencies' do
      expect(subject.missing).to eq ['missing']
    end
  end

end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
rake-n-bake-1.4.2 spec/dependency_checker_spec.rb
rake-n-bake-1.4.1 spec/dependency_checker_spec.rb
rake-n-bake-1.4.0 spec/dependency_checker_spec.rb
rake-n-bake-1.3.3 spec/dependency_checker_spec.rb
rake-n-bake-1.3.1 spec/dependency_checker_spec.rb
rake-n-bake-1.3.0 spec/dependency_checker_spec.rb
rake-n-bake-1.2.0 spec/dependency_checker_spec.rb
rake-n-bake-1.1.5 spec/dependency_checker_spec.rb